|
| [WD20] Generic tableaddline |
| Iniciado por guest, 06,oct. 2015 12:01 - 10 respuestas |
| |
| | | |
|
| |
| Publicado el 06,octubre 2015 - 12:01 |
Hi,
for some reasons I need a generic "tableaddline". In the notes section of the table columns I save the content at design time. Like:
content=myarray[1].name
another column:
content=myarray[1].age
A program reads the notes and build a string like
MyTableladdlinestring="myarray[1].name,myarray[1].age"
and final
tableaddline(mytable,mytableaddlinestring)
But it doesn´t work because it shows the complete "mytableaddlinestring" in column1 .
I need any indirection ... but I have no idea :confused: |
| |
| |
| | | |
|
| | |
| |
| Publicado el 06,octubre 2015 - 12:16 |
Hi Michael
to do that, you need to: - make sure that none of your variable contains a TAB - build your string as you are doing now but TAB separated - use tableadd instead of tableaddline
Best regards |
| |
| |
| | | |
|
| | |
| |
| Publicado el 06,octubre 2015 - 17:51 |
Hi Fabrice,
works not really. And I can´t be sure that no TABs in my fields.
It´s pity, I have a large treeviewtable and I can´t use the data binding because some columns must be in master and childfile and I can define only once in the 7 TAB. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 06,octubre 2015 - 19:59 |
Hi Michael,
may be, you can build the string like you do now and execute it by using Compile() or ExecuteCode() ? |
| |
| |
| | | |
|
| | |
| |
| Publicado el 06,octubre 2015 - 21:48 |
Hi,
I agree with Stefan, and I would try with ExecuteCode:
sName is string = "John" nAge is int = 21 sCode is string
sCode=StringBuild("TableAddLine(table1,""%1"",""%2"")",sName,nAge)
ExecuteCode(sCode) |
| |
| |
| | | |
|
| | |
| |
| Publicado el 06,octubre 2015 - 21:52 |
Hi Michael,
Perhaps something like this: TableAddline(MyTable) //add empty line nLine is int=Tablecount(MyTable) //get row # For i=1 to TableCount(MyTable,toColumn) Table[nLine,nCol]=Extractstring(MyTableAddLineString,nCol,Separator)...... end
Not tested
Regards, Piet |
| |
| |
| | | |
|
| | |
| |
| Publicado el 06,octubre 2015 - 21:52 |
Hi Stefan+Bart,
Yes, I tried this hours ago.
It works, but executeCode() fills only the first element of my array in all table rows. It looks like the compiler ignors "n" in myarray[n].name. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 06,octubre 2015 - 21:56 |
Hi Piet,
yes, I do something similar.
The Problem is here
Table[nLine,nCol]=Extractstring,MyTableAddLineString,nCol,Separator)......
perhaps extractstring gives back= "Myarray[n].name"
so we have
Table[nLine,nCol]= "Myarray[n].name"
and not the value of that ... |
| |
| |
| | | |
|
| | |
| |
| Publicado el 07,octubre 2015 - 09:47 |
Hi,
A different approach may be to define an array of structure and use this array as a datasource for your table
You can add new records to your array, and after that a simple TableDisplay to show it in your table
Bart |
| |
| |
| | | |
|
| | |
| |
| Publicado el 07,octubre 2015 - 09:56 |
Hi Bart,
its a Treeviewtable and I need to define the first Column with the result of the file1 (as master) and also as child with the result from file2.
Have no idea how to do that with direct databinding form a structure array |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 71 mensajes |
|
| Publicado el 28,octubre 2015 - 19:49 |
Hi Michael,
did you solve it? I am working now on something similar. As far I was using TableAdd instead of TableAddLine and it worked but now I am facing the same problem as you with TABs in some items, which means I probably should not use TableAdd no more...
I quite like an idea of Bart, I see that you did not make it work, I will try it myself anyway and will let you know if I was succesfull.
I also like your approach "Table[nLine,nCol]=Extractstring,MyTableAddLineString,nCol,Separator)......" and I will try it as well but I do not understand why do you use ExtractString. Should not be enough just to assign the array value to the table cell? Something like Table[nLine,nCol]=myarray[1].name.
Btw. this syntax "myarray[1].name" is new for me. Would you please let me know where is it described, I exactly mean that part ".name" ?
Thank you
Regards
Petr |
| |
| |
| | | |
|
| | | | |
| | |
|