Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ICsv AddRowMS, AddRowLA, AddRowSA
#1
Can you show an example of how to use: AddRowMS, AddRowLA, AddRowSA in ICsv?
#2
Macro Macro1405
Code:
Copy      Help
out
ICsv x=CreateCsv(1)
x.ColumnCount=3

;------------

;add empty row and use Cell
int r=x.AddRowMS(-1)
x.Cell(r 0)="c1"; x.Cell(r 1)="c2"; x.Cell(r 2)="c3"

;MS
lpstr multistring="ms1[0]ms2[0]ms3"
x.AddRowMS(-1 3 multistring)

;LA with array
str st="a1 a2 a3"
ARRAY(lpstr) a
int nt=tok(st a 3 "" 1)
x.AddRowLA(-1 nt &a[0])

;SA with array
ARRAY(str) as="as1[]as2[]as3"
x.AddRowSA(-1 as.len &as[0])

;LA with local variables
lpstr s1("s1") s2("s1") s3("s1")
x.AddRowLA(-1 3 &s1)

;SA with local variables
str ss1("ss1") ss2("ss1") ss3("ss1")
x.AddRowSA(-1 3 &ss1)

;------------

str s
x.ToString(s)
out s
#3
Thank you very much.
#4
Is possible add a flag to Sort for not include the first row (header)?
#5
Function CsvSortNoHeader
Code:
Copy      Help
;/
function ICsv&c flags [col] ;;flags: 0 simple, 1 insens, 2 ling, 3 ling/insens, 4 number/ling/insens, 0x100 descending

;Sorts skipping first row.
;See <help "::/User/IDP_ICSV.html">ICsv.Sort</help>.


if(c.RowCount<3) ret

c.GetRowMS(0 _s); c.RemoveRow(0)
c.Sort(flags col)
c.AddRowMS(0 c.ColumnCount _s)

err+ end _error

Macro Macro1405
Code:
Copy      Help
out
ICsv x=CreateCsv(1)
str csv=
;h1,h2,h3
;g,p,t
;b,z,a
x.FromString(csv)

;------------

CsvSortNoHeader x 0

;------------

str s
x.ToString(s)
out s
#6
Thanks again.


Forum Jump:


Users browsing this thread: 1 Guest(s)