Get the value tag using the web component

I already know the item (MAXI) exists, and I want to know which tag it is in.
In other words, I want to get (1001).

greetings

Show the full response content so we can see the structure returned.

Use a firebase query

Your ability to easily query your data is made more difficult by your use of AI2 lists as values instead of creating a firebase list (array) or creating sub nodes for each entry.

This is the general content.

So if you ask for "PEDRO" you would be happy to receive the list 1003,1004?

if I request (MAXI), I should get (1001)
or
if I request (PEDRO), I should get (1003)

they are their container tags

but PEDRO has two entries...

I'm sorry, that's how it would be.

Is your data insertion code insuring such duplication will never happen again, or did you just go back and fix that manually without following up on the duplication problem?

It won't happen again.

This was an example I took from a previous one.

You can do as in the attached example:

  • convert the text to a csv string
  • convert the csv string to a list
  • search the list

txt01.aia (3.6 KB)

1 Like

@davidefa jumped the gun.

Here's mine.




blocks
elmachi130A.aia (2.5 KB)

Note:

I tested this with @davidefa 's JSON text block, and it turned out that was not JSON.

Unless the original web result comes back as JSON format, my sample is useless.

1 Like

What variable should I put in (Label1), or how do I get the tag?

You have not yet learned how to call a value procedure?

enlighten me

The online book has moved.

You'll have to do some looking to learn about procedures.

Set Label1.Text to call tag ('PEDRO')

If you examine the blocks in @davidefa aia sample you will see he also packages up his logic in a value procedure and loads his labels by calling the procedure twice.

Download a blocks image of where he does that and post it here for the board, to show you understand.

You probably will need a List Picker or Listview to offer the app user the opportunity to to select a name from the Web query result content.

As previously suggest by me, IMHO, the best way to handle this is to use the power of Firebase queries, and to store your data on Firebase in a Firebase way.

Firstly, stop storing a list in the way you are doing it, and store your list data in an array on firebase. You can do it like this:

Now you see that all your data is accessible for Firebase querying.

You must set an index for the name you wish to query, in your rules, which in this case is "0":

"prueba5": {
"read": true,
"write": true,
".indexOn": "0"
}

Now you can query the data under prueba5 based upon the values in "0", and return the node/key for that value:

The situation is this:
The storage unit was positioned horizontally, and I changed it to a vertical position.
I actually got this from a previous example, but the issue is already resolved.
Thanks.

Yes, thanks. TIMAI2

The thing is, it was easier to copy the content for other activities when it was laid out horizontally;
doing it vertically is more tedious

thanks.