Generates a Clarion FILE, GROUP, or QUEUE structure
Improved auto-sizing of listbox columns (when using listbox).
Added another example for filling your own queue
Here’s the entire program for filling the queue and viewing it.:
PROGRAM
MyQueue QUEUE
id STRING(4)
first_name STRING(13)
last_name STRING(18)
email STRING(39)
END
Window WINDOW('Loading a queue from CSV'),AT(,,315,224),CENTER,GRAY,FONT('Segoe UI',9)
LIST,AT(2,2,311,220),USE(?LIST1),FROM(MyQueue),FORMAT('26L(2)|M~ID~C(2)52L(2' & |
')|M~First Name~C(2)53L(2)|M~Last Name~C(2)20L(2)|M~Email~C(2)')
END
CSV JSCSVParseClass
Ndx LONG
MAP
END
CODE
IF NOT CSV.LoadFile('.\SampleData\CSVdemo2.Comma.CRLF.csv')
MESSAGE('Did not load file.')
RETURN
END
LOOP Ndx = 1 TO CSV.GetRowCount()
MyQueue.ID = CSV.GetCellValue(Ndx,1)
MyQueue.first_name = CSV.GetCellValue(Ndx,2)
MyQueue.last_name = CSV.GetCellValue(Ndx,3)
MyQueue.email = CSV.GetCellValue(Ndx,4)
ADD(MyQueue)
END
OPEN(Window)
ACCEPT
END
Was going to leave it alone for a while, but made several more improvements. Added GetMemoryUsed() to attempt to calculate the overhead memory that is used up.
Also added GetColumnNumber, which will attempt to find a column based on its name (or part of its name).
I would like to contribute on the support of escaped double quotes. I forked the project to make some changes, then you could look at them to analyse the diff and join them on your project if you like, what do you think?
I see you made some little changes some minutes ago… do you have more changes pending?
Hi Federico - That is pretty dang nifty. So far, it’s working well. It parsed this out perfectly inside one column:
"Now is the ““time”” for all good folks to come to the ““aid”” of their solar ““system””"
became Now, is the “time”, for all good folks to come to the “aid” of their solar "system"
Thanks a whole lot.
I’ll try to do some more testing next weekend or so.
Thanks Jeff,
I’ve added a method to calculate the cell length without creating a new string, in case it is needed for performance, although I didn’t measured it.