Bad arguments to select list item - the operation select list item cannot accept the arguments:

It happens only in the loop. If I just try to access the same list and sublist without the loop, it works.

Then make sure the global count print Any number or not? Pls debug that variable or show us what is printed in global data

I already tried to put it in button to see if it had to do with screen one. That didn't work either.

The global count works for the loop if it is not with a list. I can just print out the number...

My doubt is , you have added the items to the global data,then again why do you want to print first item into the same variable? :thinking:

For global count, test with length of the list

tried again with the code in a 'when button.click' block instead of the 'when screen initialize' . Same result

Please handle the list properly . It seems you have not handled it properly

Try to catch the sqlite query into a global list, then print the desired items in different variable

Your prob is , you are printing the query items and selecting desired items and all into the same global variables

1 Like

I made separate variables now but the result is the same.

The data in global data are many. Also I am generating them in sceen one, can that be the problem? As the loop runs longer than the query of a single field, maybe it runs into an inconsistency? But then how could I extract the latitude and longitude dynamically? Ideally I can load it when button is clicked.

If your global data contains many sublists in this format, then you are approaching in wrong manner/blocks. If this is your structure then you must try as below instead of loop

for each items in the global list 
Add items to the list global or local lan
Items select list item list (get item) index 2
Add items to the list global or local Lin
Items select list item list (get item) index 3

If it is not pls show us your global data to us.

This will work only if you are not using select first items intofrom the global data

I tried the for each item block too. It also complains that it is not a list, so similar problem. I will try again.

Better remove all blocks, in screen init after the open database catch the first query function into a one lable then show us the result to us..

Else this topic will go on without knowing your output. Just imagination only we can suggest.

Then use split text at ,
In the above blocks (for each item event) instead of using get item into the event try to use split text at , get item

I go to bed and try again tomorrow. Thanks for all the help.

So in the end it seems my triplet lists that look like this [default, 39.57128145106525, -7.635200049198133] are not recognized as lists. Then what are they? and how do I make them lists to extract the info? They are not strings either and I can't split them. They have been produced by simple sqlite through the SELECT statement you can see in the code. I really haven't got a clue how to solve this...

I notice you are using my Simple Sqlite extension. Are you using the latest version (V3). This has a "ListFixer" block built in to the extension to convert what looks like a list to an AI2 list. (There was a separate extension containing the list fixer for earlier versions, but this is now obsolete.)

This issue has always been included in the extension documentation....

I will try that. I can't see a version number and I installed the extension from another computer so I don't have the file.

I noticed in my list, the first element is a string but it has no quote marks. Could that be causing the problem?

No, the problem is as I have indicated in the documentation.

Upgrade to the latest version of the extension here, and use the listFixer block on your select queries.

image

Listfixer has done the job. You can't imagine how happy I was to get 'true' for the 'is a list' block. Thanks a lot TIMAI2 , great extension!

1 Like

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