PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV 2024 → [WD21] Difference of TABLE.. and TABLE[TABLE]..
[WD21] Difference of TABLE.. and TABLE[TABLE]..
Started by Christine Wagner, Jul., 20 2017 12:14 PM - 4 replies
Posted on July, 20 2017 - 12:14 PM
I can't find this in the tutorial book or the concepts book.

We have code like
IF TABLE_Example[TABLE_Example].COL_Title <> "" THEN
//do something
END

We also have code like
IF TABLE_Example.COL_Title <> "" THEN
//do something
END

There seems to be no difference.

But trying to use TABLE_Example[TABLE_Example]..FontStrikeOut = True works,
trying to use TABLE_Example..FontStrikeOut does not work? (I'm getting an compile error: The 'FontStrikeOut' property does not apply to this type of control.)

So I'm missing something. What is the difference between the two?
Posted on July, 20 2017 - 12:31 PM
Hi.

TABLE_Example refer to control table.

TABLE_Example[TABLE_Example] refer to current table line, the last add to table for example.

The properties for table and line are diferents.


Rubén
Posted on July, 21 2017 - 8:21 AM
Thanks for the answer.

So TABLE_Example is different from TABLE_Example[TABLE_Example], but there is really no difference between using TABLE_Example.COL_Title and TABLE_Example[TABLE_Example].COL_Title as both will point to the same column of the current table line.

Greetings

Christine
Posted on July, 21 2017 - 11:14 AM
Christine,
Both will work but under some situation will fail you, like if the table is empty and you have code on the "Selecting a table row" process of the table control.

Better practice would be something like.

nRow is int = tableselect(TableExample) //Or if you are looping thru the table use "Currentsubscript" nRow is int = CurrentSubscript(TableExample) //This would be for code used on the "Displaying a table row" of a table control if nRow = -1 return (Or error message) TableExample[nRow]..FontBold = true DW
Posted on July, 21 2017 - 4:15 PM
Thanks a lot for this explanation. It is clearer now for me.

Greetings Christine