Select list item: Attempt to get item number 2 of list of length 1: [“[“”]”]

Hi, this earlier I thinking problem had been solved, but actually not. I suspected marking there have incorrect block? But I don’t know how to solved it, If found only 1 record will show error message, I trying to solve it but still not able to find the solution.
Appreciate anyone can help on this.

error

Everything is fine with the Row list. The problem is with the split at "," block. Display the contents of the Row list in the label to see if each of the items in the list has a comma separated value.

Yes, content has show comma separated value, but I can use 'replace all text' block to remove all those comma separated value. my problem only if less than 2 records found label did't display the content, if I change the [length of list list get global Row < 1] label can display my content, but if no record found will show the runtime error message, I want no record found just display message No record found.

Hello Hoong

Is this data arriving from an Arduino or similar? The issue (runtime error) is that 'Row' does not have 3 values e.g. val1,val2,val3 and your length of List test is incorrect - should test if length is < 3.

Has the variable 'Row' been initialised as a List?

Next issue is that you are splitting the data row several times in a For Each Loop. If there needs to be a Split, it would be a one-off from csv string (Row) to List, before the following allocations.

You also initialise Co1, Col2 and Col3 as strings (text) variables, but then try to add values to each of them as though they were Lists. Also the column indexing is wrong.

Finally, again you are using a For Each loop but then ignoring it and applying all 3 values to their respective columns! So the same values are applied three times!!

These are your problems, not what you were thinking at all :upside_down_face:

To help you, we need an accurate representation of the data you need to process, and a description of what the goal is - present three columns of data as ListViews? We need to know.

Export your .aia file and upload it here.


also include your complete sketch.

Check_bal_online.aia (19.2 KB) phone

I attached output phone screen together on picture 1 and picture 2 is source data.

Use the greater than or equals maths test

image

Hi TIMAI2 , I tried your suggested but failed.

See this topic, which is doing something very similar
https://community.appinventor.mit.edu/t/how-can-i-count-list-from-mysql-result-i-am-trying-to-make-cart-list/37136/8

Never initialize a list as a blank text.

Initialize as create empty list instead.

P.S. It is poor programming practice to update global variables from a procedure. It makes it hard to trace side effects in a program. Better to use procedure parameters for all inputs, and to use value procedures to return results, or do the update in the calling code.

Hi TIMAI2, follow you shared this link and rebuild my block finally I managed to solve my problem already, Thanks all.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.