How do I handle error when more than one record found?

Hi, may I know how to handle this error, if found more than one records in SQL database will prompt runtime error ?

I tried created check error button, but seem like not good solution.

my block

anyone help is much appreciated.

The error arise cause global lists contains 5 items and global row contains 6. One way is to change the list in the for each number from 1 to ... block to global lists.

Another way is to create a new joined list for the first 5 items in your csv data

Since is your database don't you know from the beginning how many records do you have in order to create theglobal lists accordingly?


We have a huge numbers of records in our SQL database, all records we use sql query to output by column name, but some of the records have duplication more than 3 time. i show you this query record separate by '|'

so far i only query by member name, member number, expire date,hp number, DOB and status (total 6 columns).

1 Like

tested, first option more suitable for me.
do you have any idea how to separate "|" for next record ?

Regarding the '|' detail separator, yes, AI2 has a list block to split at a given character ('|') to turn a text string into a list.

But given that you are using a SQL data base, why aren't you using a SQL JOIN in your query to get those master/detail records one per line?

P.S. I see in your URL the phrase "/apex/". Should I infer from this that you are talking to Oracle Application Express (APEX), the free Oracle Express database edition?
We don't have a sample of that yet.

Hi ABG, yes you are right.
I'm using the Oracle Application express (APEX).
i try use your suggestion SQL Join to separate next records one per line first.

I tried the Oracle Free online pet food store web site and database sample a while ago, but didn't want to load up my PC with Oracle database instances and tools.

How much of Oracle's tool set is online these days, and how much still requires PC space?

AI2 needs easy online SQL back ends for experimenters.

Sorry i don't have too much information regarding oracle tools set, maybe you can visit the oracle website to get more info, our SQLdatabase is setting up by software vendor.

official website

Hi ABG, beside that can you share with me how to use block split character ("|") on next record ?

In the pink text blocks you have a block named "split.text". The block has two inputs - "text to divide" and "split character, e.g. |". A list will be created at the block output.

thank you for your info.
i try to put here , but still not working.

On the output of this block, a list of your records is created. You should know which record you are interested in and use the "select list item" block.

Your '|' markers are effectively acting as end-of-row markers.
They are the outer delimiters, with commas as the inner delimiters.

So if the responseContent is passed through a
replace all '|' with '\n' text block, you would have perfect text to input into a
list from csv table block, which would return a table (list of lists).

If you wish to see sample code, post exported .aia file or individual block PNG exports.

Please export your project and post it here.

Please download and post each of those event block(s)/procedures here ...
(sample video)

1 Like

Read_URLSQL.aia (10.0 KB)

Could not replicate your problem cause I do not have your memberships numbers . What I did was to put a notifier if a record was not found in your database. Try this

Read_URLSQL_1.aia (10.5 KB)

yes,this is what i need !! at least no data found in database won't show error message for user to end application.

thanks dora_paz.

1 Like

Hi ABG, any idea can share with me the sample code for replace '|' with '\n'.

use the replace all block rom the text drawer and replace '|' with '\n'
just do it...
see also MIT App Inventor Text Blocks


sorry, could be my earlier message make you all confusing. this special character '|' is marked for next record.
I trying use the replace all text block, but unsuccessful.

I tried to use your image as an example

If you have more than one record then you can try something like this , replace | with \n and then you have a table with 3 rows. I do not know if this helps