Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
5
Erster Beitrag:
vor 4 Monaten, 3 Wochen
Letzter Beitrag:
vor 4 Monaten, 3 Wochen
Beteiligte Autoren:
Christine Wagner, DW, Ruben Sanchez Peña

[WD21] Difference of TABLE.. and TABLE[TABLE]..

Startbeitrag von Christine Wagner am 20.07.2017 10:14

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?

Antworten:

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

von Ruben Sanchez Peña - am 20.07.2017 10:31
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

von Christine Wagner - am 21.07.2017 06:21
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



von DW - am 21.07.2017 09:14
Thanks a lot for this explanation. It is clearer now for me.

Greetings Christine

von Christine Wagner - am 21.07.2017 14:15
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.