Page 1 of 1
Repeat with a list
Posted: Sun May 01, 2016 3:09 am
by RossG
My attempts to spit the list into a few lines have all failed.
I see that the symbol to use is "\".
How can I do this?
repeat for each item tItem in "Black10Record,High10Record,Low10Record,Odd10Record,Even10Record,Red10Record,Black20Record,High20Record,Low20Record,Odd20Record,Even20Record"
set the visible of field tItem to "false"
end repeat
Can't get the code to insert correctly.....the list should be on the "repeat" line and the " at the end of the list
has disappeared....
Re: Repeat with a list
Posted: Sun May 01, 2016 1:02 pm
by AxWald
Hi,
try
false instead of
"false", it's a constant and not a string!
And to have it better readable, try:
Code: Select all
put "Black10Record,High10Record,Low10Record," & \
"Odd10Record,Even10Record,Red10Record,Black20Record," & \
"High20Record,Low20Record,Odd20Record,Even20Record" into MyVar
repeat for each item tItem in MyVar
set the visible of field tItem to false
end repeat
Have fun!
Re: Repeat with a list
Posted: Mon May 02, 2016 3:15 am
by dunbarx
Hi.
"false" does not fool the LC parser. It will work fine either way. I always place such constants in quotes.
That said, please post verbatim the lines that are throwing the error. It is likely just a small typo or syntactical error.
Craig Newman
Re: Repeat with a list
Posted: Wed May 04, 2016 4:06 am
by Opaquer
RossG wrote:My attempts to spit the list into a few lines have all failed.
I see that the symbol to use is "\".
How can I do this?
repeat for each item tItem in "Black10Record,High10Record,Low10Record,Odd10Record,Even10Record,Red10Record,Black20Record,High20Record,Low20Record,Odd20Record,Even20Record"
set the visible of field tItem to "false"
end repeat
Can't get the code to insert correctly.....the list should be on the "repeat" line and the " at the end of the list
has disappeared....
Perhaps try this instead:
Code: Select all
repeat for each item tItem in "Black10Record","High10Record,"Low10Record,"Odd10Record","Even10Record","Red10Record","Black20Record","High20Record","Low20Record","Odd20Record","Even20Record"
set the visible of field tItem to "false"
end repeat
That way there can't be any errors at all. Also make sure that itemDel is set to ","? Just in case it got set somewhere else? Those are my best guesses anyway - let's hope it works

!
Re: Repeat with a list
Posted: Wed May 04, 2016 12:17 pm
by Da_Elf
dont forget to set the item delimiter
Code: Select all
set itemDelimiter to comma
put "Black10Record,High10Record,Low10Record,Odd10Record,Even10Record,Red10Record,Black20Record,High20Record,Low20Record,Odd20Record,Even20Record" into myList
repeat for each item titem in myList
set visible of fld titem to false
end repeat
Re: Repeat with a list
Posted: Wed May 04, 2016 1:13 pm
by bn
locking the screen before the repeat loop and unlocking it after speeds this up tremendously.
Kind regards
Bernd
Re: Repeat with a list
Posted: Sun May 15, 2016 1:16 am
by RossG
The problem was lack of the "&".
I thought that the "\" would assume the following
line was to be concatenated, but it's not so.
BTW Am I the only one who always gets it wrong
between
repeat with
and
repeat for.
Seems that one or the other should be sufficient.
"repeat for" is, as far as I can remember, the usual
in other languages.