what command to use ?(table)

Startbeitrag von x> am 07.07.2017 18:26

I would like to browse a table and extract the rows to another table.So far i have managed to do it with only the firs row.Can someone tell me what comand i can use to modify TableRecNum so i can make a loop that extracts all rows .

tableaddline(table2)
table2.col1=table1.col1
table2.col2=table1.col2

Antworten:

Hi

Let me start by saying that it looks like you should start by studying the tutorial that comes with WinDev, in DETAILS.

Then, to answer your question:
- if you search for LOOP in the help, you'll find a number of statements you can use (it's a choice which one): https://help.windev.com/en-US/search2.awp?q=loop&mode=user&origin=searchbox
- as for the table itself, it depends first on the type of table (you are not saying if it's linked to a file, filled by programming, etc), so I must first refer you to the basic help on table controls here: https://help.windev.com/en-US/?1013224&name=Table_control
- but in any case, you should always use the line number in your statement (something like table2.Col1[LineNumber2]=table1.col1[lineNumber1])

Best regards

von Fabrice Harari - am 07.07.2017 18:42
table bye programing:

tableaddline(table2)
table2.col1[1]=table1.col1[1]

i just tried it generates error

von x> - am 07.07.2017 18:51
what error?

von Fabrice Harari - am 07.07.2017 20:15
Hi

Indeed you should take a look at the tutorial it saves you time. But I will try to help you out a bit in your question

It is raw code but it will do what you want

if you make the table muti select you can use this. This is if you have 10 lines but onley want 5 to be placed in the second table.

FOR EACH SELECTED ROW OF TABLE_NoName1
TableAddLine(TABLE_NoName2,TABLE_NoName1.COL_NoName1,TABLE_NoName1.COL_NoName2)
END

Otherwise:

FOR EACH ROW OF TABLE_NoName1
TableAddLine(TABLE_NoName2,TABLE_NoName1.COL_NoName1,TABLE_NoName1.COL_NoName2)
END

von Allard - am 07.07.2017 22:49
i get this error message;
File or query used by TABLE_1 as data source.
Only visible elements will be available in programming.

von x> - am 08.07.2017 01:37
I think you have your tablecontrol setup as a browsing table, so bound to a database file. Then the data is coming from that side (directly or using a query). You want to manually add data, then you have to make it a tablecontrol "handeld by programming". You can do that somewhere in the description of the control.

von Arie - am 08.07.2017 09:58
Hi

so you said that your tables were filled by programming, but that clearly is true only for the table 2.

For a table linked to a file, only the lines that are VISIBLE at any given time are loaded in memory and therefore usable in code, so when you are doing your loop, you are using a line index that just doesn't exist at that moment.

Best regards

von Fabrice Harari - am 08.07.2017 20:00
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.