|
Oracle Apprentice
Joined: 29 May 2002 Posts: 121
|
Posted: Sun Nov 21, 2004 3:04 am
Looping through Stringlist |
Anyone have any idea why this doesn't work for looping through a stringlist?
#FORALL @VContents {#VARIABLE VContents %trim( %i)} |
|
|
|
Aarlot Adept
Joined: 30 Dec 2003 Posts: 226
|
Posted: Sun Nov 21, 2004 3:16 am |
Hrm... with the way you have it, the first item on the list will be written to VContents, overwriting everything else in the variable, thus only having one value to loop through.
IE: Vcontents has Blah, Blah2 and Blah3 in it. Your #FORALL goes to the first entry, Blah. It then does "#VAR VContents Blah" which makes the value of @VContents "Blah" rather than "Blah|Blah2|Blah3". Since there are now no more values in the variable to loop through, it is finished. That's the problem, I'm pretty sure (untested). You'd probably have to do something with #ADDITEM to do this and have it work.
_ |
|
_________________ Everyone is entitled to their beliefs - until they die. Then only the truth matters. |
|
|
|
Oracle Apprentice
Joined: 29 May 2002 Posts: 121
|
Posted: Sun Nov 21, 2004 4:56 am |
You know that is a good point, I've also tried it with #additem and it didn't work either, in fact gave me wierd results:
#FORALL @VContents {#additems VContents_new %trim( %i)} |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sun Nov 21, 2004 5:20 am |
#FORALL @VContents {#ADDITEM VContents_new {%trim("%i")}}
|
|
|
|
Theragil Apprentice
Joined: 13 Feb 2004 Posts: 157 Location: USA
|
Posted: Sun Nov 21, 2004 5:21 am |
What is it you're trying to do? Changing the value of the variable you're looping over while you're looping over it doesn't make much sense without some context.
|
|
|
|
|
|