adding data to table

gjoisa

Active Member
Licensed User
Longtime User
Hi all !

I want to fill some data to a table (Not from database or csv ) which consists 2 rows and 82 columns . How to add it ?
 

RB Smissaert

Well-Known Member
Licensed User
Longtime User
From the help file:

Adds a new row to a Table.
Syntax: AddRow ([Value1, Value2,...])
If the number of values is less than the number of columns, then empty cells will be added.
Example:
Table1.AddCol (cNumber, "ID", 50, True)
Table1.AddCol (cString, "Name", 50)
Table1.AddRow (234564, "John")


RBS
 

JesseW

Active Member
Licensed User
Longtime User
the above demonstrates how to add new data rows to a table. if you want to change the data in an existing row, use the Table1.Cell("ColName", RowNumver) property. you'll be able to find an example in the desktop ide help file under Table in the Controls section.
 

Kintara

Member
Licensed User
Longtime User
Adding the data as a variable

OK So If I had DATA1$="1,2,3,4,5" is there a way I could add this to a new row in a table.
obviously
Table1.Addrow(Data1$) does not work.
Will I have to break it down to the individual values to addRow?
i.e.
Table1.AddRow("1","2","3","4","5")
Shame as using a variable string is so much less typing!

Any Ideas?

Kintara :cool:
 

derez

Expert
Licensed User
Longtime User
you can split the string using splitstr and then use a loop with cell, to assign each cell with its matching string from the list.
 

specci48

Well-Known Member
Licensed User
Longtime User
OK So If I had DATA1$="1,2,3,4,5" is there a way I could add this to a new row in a table.
obviously
Table1.Addrow(Data1$) does not work.
If you could imagine using a listview instead of a table the following code line will work:
B4X:
data1$ = "1,2,3,4,5"
lv.AddRow(StrSplit(data1$, ","))

A sample code is attached...


specci48
 

Attachments

  • AddRow.sbp
    839 bytes · Views: 174

Kintara

Member
Licensed User
Longtime User
OMG - You guys are good!

Thanks for your replys. I'll be giving them a go, but suspect it will be the split string method. Lists are ook, but I'll be needing to filter it - I'll stick with a table.
thanks guys.

Kintara :cool:
 
Top