Need help with the bock look up pairs key

hello people i have a problem , i have a api answer with json.
I know how to load elemets in a list with the look up pairs key block.
and i know how to use it if the pair is in a sublist in the element.

But there is a problem if you have a json tree with multible elements and sublists which have the pairs in the sublist. If you have a pair and the pair is null than you get a error.

Here you can see that there are some elements from 0 to 20.
if you open a element you see the different items (pairs ) inside.
You have also a sublist with the name coin. and that sublist coin have the pair Website.

normal you have the website like www.google.com
but sometime you dont have a website because this elememt have no website
than you have a written null there like that.

or you dont have the sublist coin inside.

here is my question.

If there is a null in the pair website i get each time a error cannot lok up pairs key.

or you dont have the sublist coin because that event is not a coin and so you dont have the infos for the coin

than i get also the error cannot lookup pairs key.

What can i do now that i can load in the list because if you dont have the sublist coin or you have a null in the pair website you get each time a error.

normaly i work with that and this works but only if in each element i the json tree are that pairs what you wantl

I tried to work with that

and this does not work in all way that i tried.
I worked now since more as a day to solve that problem but i havent solved the problem for me.

i asked also a team member which explained me thow its works to load pairs in a list.
But as i said if one element in the json tree does not have the sublist coin or the website pair is null you get errors.

Please can a person help e with that.

the solution if a person needs it!

2 Likes

for nested lookup in pairs calls, you might want to add a list of lists in the first notFound socket to avoid an error in case the website does not exist

that list of lists could have only one pair like this
Unbenannt
coin
website not found`

How does the lookup in pairs block work?
Taifun

2 Likes

hey Taifun, thanks for you answer.

I dont understand you answer , sorry.

I have that API URL
https://kryptocal.com/api/events?fromDate=2019-04-01&toDate=2019-04-30
which gives me a list of elements. back n Json.
Each Element have different Pairs inside.
Some Pairs are in a sub list like “coin”
And in that sublist there is a pair called website.

sometime this pair or how you call it have no website in it, but it has the word “null”
or the sublist coin does not exist.

This two things is a big problem because if there is a null or the sublist coin is not there you get a error and no items are loaded in the list.

I dont know how i can solve that problem.

I have no problem to load all paris which are in a element in a list and display it when it the item is needed.

I have tried different things like a if then else block , i tried it with the text block compare text.
i tried it with a “=” block but i get each time a error equal what i do.

Maybe you could explain it to me.
I serched the whole goole for that error, i looked inside all forums and read all posts with the wblock look up pairs key.

i looked videos but i find no solution for my problem,

I tried all what i can try in all way with not without with = null
with = not found, with compare text in all ways, with json extension but the extension does not work in a for all items in a list block.

i get crazy since friday evening i want to solve that issue but i dont get it to work. A tema member wanted to help me but all what he show me does not work.

This is my last post about that sh…t because i waste around 20 hours for that and i have no solution. in that time i could make 1000 different things.

I find in the whole interfnet no solution to what i can do if there is not the sublist or a solution if the website have a null as pair.

So please could you show me some blocks how i can solve this.

i looked your link but that i have read yesterday and it does not help me. lookilooki.aia (9.9 KB)

i have made a aia where you have the listview and the blocks for the add item ti list.

i say 10000000000 times thank you if you can solve my problem.

1 Like

please try this and if you have issues, post a screenshot of your relevant blocks

Taifun

1 Like

hey again, i dont know where i have to put in the block. really man i dont understand what you mean.

this is how i use the data what i get from the web get.

this is how i normal use that blocks. but this does not work.

i tried it also so

i have really now idea really.
i am on the end with my latain.

1 Like

this is a nested lookup in pairs block
Unbenannt2

so what happens, if the webiste is not found?
the string “not found” will be returned
now the second lookup in pairs will be executed, however the string “not found” is not a list of lists, therefore that lookup in pairs block will get an error

and the suggestion will fix that like this

Now you might understand, how important it is to use Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
Taifun

1 Like

ok i and where i have to put in the item if the for each item in list block that i get the websites form each elememt in a list. with that.

if i create list on my own i have no troubles, i know all your posts.

1 Like

I gave him a working Solution which checks if it’s null then return no url else return the pairs and it’s working perfectly but he doesn’t seem to understand it

1 Like

sorry, I don’t understand, what you are talking about
it seems to be, you will have to go one step back and first do some more tutorials to learn the basics, then come back and continue

Taifun


A very good way to learn App Inventor is to read the free Inventor’s Manual here in the AI2 free online eBook App Inventor 2 Book: Create Your Own Android Apps … the links are at the bottom of the Web page. The book ‘teaches’ users how to program with AI2 blocks.
There is a free programming course here Course In A Box and the aia files for the projects in the book are here: App Inventor 2 Book: Create Your Own Android Apps
How to do a lot of basic things with App Inventor are described here: How do you...? .

Also do the tutorials Tutorials for App Inventor | Explore MIT App Inventor to learn the basics of App Inventor, then try something and follow the Top 5 Tips: How to learn App Inventor


1 Like

This post was flagged by the community and is temporarily hidden.

1 Like

it does not look like you read my detailed answer


I feel like I wasted my time with you, but probably my answer will help someone else with the same issue in future
Taifun

3 Likes

Can you provide the solution here please so it is available to searchers.

no man it was not a wasted time for you and not for me. I read your post i believe 3 times because at the first time i didnt understand it.

i understand what you want to show me with the blocks but i dont understand all.
i understand that with the not found what you told but on your image i see at the end two stirngs with try not or so.
So where i have to out i the item fro the block for each element in the list. you have made to lists and i ahve only one.

1 Like

This is the solution guys

2 Likes

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