Welcome! Log In Create A New Profile

Advanced

Table control syntax

Posted by mixgh 
Table control syntax
June 09, 2022 03:29AM
Hi,

I'm running a For Each Row of Table loop from a button and if it fails a condition, I would like to change the color of the currently processed row. I just can't seem to get the syntax right. I tried

For Each Row of table
if condition then
table[table]..Color=iwhite
end
End

but it doesn't work. I also tried

For Each Row of table
if condition then
subscript=tableselect(table)
table[subscript]..Color=iwhite
end
End

This doesn't work either. Any help would be much appreciated

Thanks and regards

issah
Re: Table control syntax
June 09, 2022 03:43AM
Solved....please disregard

Thanks

issah
Al
Re: Table control syntax
June 09, 2022 03:52AM
Hello Issah

In my experience the For Each function for tables is broken.

After several issues like yours when it was first released, I only ever use the old way.
nTbleRow is int = 0
nTbleCount is int = TableCount(Table)

For nTbleRow = 1 to nTbleCount

I know the For Each function is supposed to be faster but it is unreliable. I think it scrambles its internal counters if you do anything that uses a "Table" function inside it's loop because it works ok otherwise.

Regards
Al
Re: Table control syntax
June 09, 2022 07:35AM
For Each Row X of table
if condition then
table[X]..Color=iwhite
end
End
Re: Table control syntax
June 09, 2022 02:02PM
Thanks. I'm good now.
Re: Table control syntax
June 10, 2022 02:38AM
Hi AI,

Does your mistrust of the For Each construct have anything to do with the size of the table?

Regards

issah
Al
Re: Table control syntax
June 10, 2022 03:40AM
Hello Issah

No, the size of the table doesn't matter and I have some quite large memory tables.
I do use the For Each function in memory tables but only when I do not also use any table functions inside the loop.

The problem may have been fixed as I am going back a few years now.
From memory, the loop would stop and exit if I changed a value in the table.

Regards
Al
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: