Parsing as string

Hello,I’ve always had this problem and I just cannot get this sorted out (for years now). I just thought I’d get to it when I have to…

Now I have to…

I have a single dimmed array.

But I cannot parse info out of it…

For iRow% = 1 To rowCount% Step 1

	For iColumn% = 1 To 7 Step 1

		Call body.BeginInsert(rtnav)

		testvalue = Evaluate (| @Word( testArray(iRow%); "%"; iColumn%) |)

		Call body.AppendText( testValue )

		Call body.EndInsert

		Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)

	Next

Next

In this case I fail at the Evaluate line…

“error in Evaluate macro…”

Subject: evaluate

You’re mixing up your lotusscript variables with your macro

The line

testvalue = Evaluate (| @Word( testArray(iRow%); “%”; iColumn%) |)

will try and run the formula @Word(testArray(iRow%);“%”;iColumn%)

This won’t run, imagine typing that into a formula agent.

What you want to do is use the testarray and icolumn variables, so use:

testvalue = Evaluate (| @Word(| & testArray(iRow%) & |; “%”;| & iColumn% & |) |)

Subject: “Operation Failed”

That’s the error I get when I try your suggestion… (and your suggestion does make sense…)

y’know… I can do a multi dimmed array and do this… but the darn thing just won’t work while trying to parse a string…

For iRow% = 1 To rowCount% Step 1

	For iColumn% = 1 To 7 Step 1

		Call body.BeginInsert(rtnav)

		

		testvalue = testArray( iRow% -1 , iColumn% - 1)

		Call body.AppendText ( testValue )

		

		Call body.EndInsert

		Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)

	Next

Next

but when I try to use an array with data seperated by an % …it won’t work…

Example of array data…

Dim testArray( 3 ) As String

testArray(0) = "99999" + "%" + "Commercial Products Division" + "%" + "Schmo,Joe" + "%" + "Title Stuff" + "%" + "Dept Stuff" + "%" + "Super Visor stuff" + "%" + "01/02/2010"

testArray(1) = "99998" + "%" + "Commercial Products Division" + "%" + "Kilmore,Joe" + "%" + "Title Stuff" + "%" + "Dept1 Stuff" + "%" + "Super Visor stuff" + "%" + "01/02/2010"

testArray(2) = "99997" + "%" + "Commercial Products Division" + "%" + "Dread,Joe" + "%" + "Title Stuff" + "%" + "Dept2 Stuff" + "%" + "Super Visor stuff" + "%" + "01/02/2010"

Subject: split / join

I’m a bit confused at what you are trying to do but take a look at the Split and Join functions as they may help you with your dilemma

Subject: lotusscript

As mentioned, just use ls. Would be much easier and quicker.

Subject: use strtoken

replace

testvalue = Evaluate (| @Word( testArray(iRow%); “%”; iColumn%) |)

with

testvalue = Strtoken(testArray(iRow%),“%”,icolumn%)

j.

Subject: That was it!

Thanks so much…I’ve never seen strToken before till now…

~Salute