I tried a different project and virtually the same blocks and it worked fine with or without the variable:
Preview:
I tried a different project and virtually the same blocks and it worked fine with or without the variable:
Preview:
Hi folks, this seems to be working on the actual JSON Matt has provided -
Output on my label -
Just instead of giving the property’s path via text, we use the inbuilt list.first & another get property block. Let me know if this helps. Cheers!
Yes, it worked for me, too, just above your post, if I used a different project. So it wasn’t the JSON or the blocks we were using… it was some corruption in the projects. I’m still not clear why it didn’t work.
Ah ok. Personally I always use the blocks approach instead of text-based path, as it gives me a clear idea of the structure I’m dealing with. In conclusion both approaches work, its upon @matt_toyntond361 now to decide which one he’d like to go with.
Thanks so much everyone, ill have a play using both ways to see if it works for me, sorry i couldnt reply any sooner but i had reached my reply limit in the forum as a new user last night
Both, thank you so much that is working - really appreciate you giving up your time to help out !! For ref adding an image works just fine with notation was just the ingredient’s list.
@tatiang @kartik14 One final question, and ive tried googling this but is it possible to change the text colour of certain ingredients in Thunkable IE can i create a Data source of known bad ingredient’s and get these to display in RED i know this is off topic and can create a new post if thats better
It’s probably best to create a new topic about your question. Yes, there are ways to do this, some easier than others.
@matt_conroy @kartik14 I discovered something related to the JSON parsing issue. I noticed that if I use the variable app variable ingredients to avoid list
in the does list contain
block inside my loop, it crashes the project. If I use a static list of values in that block, it works fine.
Project link: Thunkable
These blocks work:
These blocks crash:
Using static text values in the initialize variable
block also crashes:
@tatiang I’ll have to see what may going on here. Maybe @ioannis has an idea? You are correct though, when using the does list contain
block, it returns the following in the console:
TypeError: Cannot read properties of undefined (reading 'indexOf')
@tatiang I copied the same blocks into a new app and tested and there were no problems.
Thunkable
@manyone in your case, I think the second screenshot returns fault because is checking if is the same list and it should return fault because even if it contains the same items you have two lists
To understand that I tested this app
https://x.thunkable.com/projects/641859672ce3024e0a6ec216/cd71d271-dd56-41ce-a448-4ee96252daf6/blocks
that sounds wrong! any object containing a value of, say 5, should match another object also containing the value 5!
this is ridiculous though - even this one is FALSE!
on the other hand we do have an <is_list_empty> block so we don’t have to compare a list to <empty_list> to find out.
@manyone If you want to compare 2 lists you will need to use the join block first
I didn’t know you could do that! Thanks for the tip.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.