Hello, I am learning the jokhttputils2 library in B4J and have managed to request queries from a mySQL database located on a server. It's easy to read one cell, however when I read all data in i.e Firstname, I've noticed that all names is sent as a long string in job1.GetString so that when put in a TableView all items is treated as one long string even if I add print $row["Firstname"] . chr(13);
Will I have to split the string job1.GetString with regex in JobDone sub or is JSON the solution?
This problem make it impossible to click on a single line in TableView since all added items is treated as one long string. Please help me!!
Thanks, but when I tried this in JobDone the singleselection does not correspond to the line I am selecting. I can select from index 1 and halfway then when I scroll down to select one of the lower items in the Tableview it selects another row. I followed your advice and also added code to make the items visible in the tableview, since that's what I want to achieve, to read from my MySQL database and have the jokhttputils2 use Job.GetString from the database. I'm sorry if I missunderstood which library handles what, but I'm new to this. I added jokhttputils2 to access httpjob, so that's what I am starting out with. If I can learn to do this without JSON I am happy because I think JSON seems complex to use. Your solution looks great as a shortcut, but how to list the items properly inthe tableview? I attach an image for what happens.
B4X:
For Each Item As String In Regex.Split(Chr(13), Job.GetString)
'Log(Item)
Row(0) = Item.Trim
Tableview1.Items.Add(Row)
Next
Blue arrow is what I clicked at.
Note: It does show correctly in log(item) as you wrote.
Erel, it seems to work with a ListView, I just tried it and selection works ok. Can you please tell me why I could not add the items into the TableView, because that's really the control that I want to use. Perhaps ListView can have columns (as it is possible in .NET C sharp) but this is B4J so it might be different. There must be a way to add those items to TableView instead of using JSON, so I leave this question open. Thanks