Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[solved] best way to store paragraphs per file entry?
#1
Hi,

I have unique paragraphs of text that I want to store and fetch easily.

I tried using spreadsheets but they're too slow to use when fetching data.

I tried using setfile and get file, but when I store the strvar.getfile into an array, the array elements will wrongly tokenize the data based on new lines, which some paragraphs have. So, some paragraphs get split up, which I wish to avoid.

Here's some sample data

1.
asdfadfsasf

34324234

34gdfvtft


2.
23423f
23dsfdsf
6gfdg


3.
asdfdsf3r4

hjrthjru


If all goes well, that should be 3 array elements.

Thanks.
#2
Use CSV file or Sqlite database.
CSV is easier. It is good if it must be a text file, and the file will not be very big.
Or use str function escape() to replace new lines to QM string escape sequence [].
#3
I'm trying to use icsv to write to a csv

I modded the help file code to use my file path and the code worked, but today, I keep getting this error. I'm totally confused.

Code:
Copy      Help
str s ss
ICsv v._create
v.FromFile("C:\test\test.csv")

int nr=v.RowCount
int nc=v.ColumnCount
int r c
for r 0 nr
    out "--- row %i ---" r
    for c 0 nc
        s=v.Cell(r c)
        out s
        s.trim
        v.Cell(r c)=s

v.ToString(ss)
out ss


Error (RT) in Macro: 0x80070057, The parameter is incorrect. ?
#4
Probably the file contains invalid CSV. For example, " is non-escaped or non-closed.
#5
I select all and deleted everything - even deleted extra sheets.

Still has same error though.
#6
What text now is in C:\test\test.csv?
And in which line error?
#7
Ahh, I see what happened.

I had to create a new text manual (windows explorer, right click, text file), rename it to test.csv OR open the spreadsheet program and save a blank file as test.csv.

I think I was in windows explorer, right click, make new xlsx file, renamed it to test.csv and the file structure was still xlsx so it was unrecognized by quickmacros.


Forum Jump:


Users browsing this thread: 5 Guest(s)