Text components

In the thunkable documentation there is a “split text” component in text.
However while programming in thunkable when I open the text tab, this option does not appear.
What am I doing wrong?

Can you share the link to the documentation? It may be outdated.

What are you trying to do? Can you give an example of how you would want to split a text string?

You will probably need to use the get substring block: Text Blocks - Thunkable Docs

this is the link.

I am using an api from image detection model (from ximilar). I want to count the number of times a particular variable “name” appears in the json response

Tried a few variations still not working
Any suggestions please?

regardless of how many times “name” appears in text, still only get answer “1”

I’ve changed it to the following. I am creating a dynamic variable called “seenproduct” which is the actual name of the item I am looking for in the result of the image detection test.
And then "for each item “variable seenproduct” in list test’s text
I am changing the variable count (already initialized at 0) by 1
In this way I thought I should be counting the number of times my dynamic variable appears in the text.
But still get answer 1 each time

https://classic-docs.thunkable.com is for the Classic version of Thunkable which was retired in 2020

Can you post the full JSON response as text (make sure to format it using the </> button in the forums toolbar)? And then if you specify which value you’re trying to count multiples of, I can help you.

{"records": [{"_url": "http://res.cloudinary.com/draczwpg7/image/upload/v1694442877/bknym4zzuj438vsyvwwy.png", "_status": {"code": 200, "text": "OK", "request_id": "b9f44ccf-df02-4d70-b727-59dc0442f2f2"}, "_id": "9f6b1deb-0c6d-4637-abe0-33ed5b1f89da", "_width": 640, "_height": 480, "_objects": [{"name": "Dental Floss Refill", "id": "1a9c0076-5e5b-490a-95f3-0b63ae131270", "bound_box": [252, 14, 333, 388], "prob": 0.8049320578575134}, {"name": "Dental Floss Refill", "id": "1a9c0076-5e5b-490a-95f3-0b63ae131270", "bound_box": [340, 20, 433, 396], "prob": 0.6499752402305603}, {"name": "Dental Floss Refill", "id": "1a9c0076-5e5b-490a-95f3-0b63ae131270", "bound_box": [340, 19, 562, 390], "prob": 0.4679369330406189}]}], "version": 4, "model_format": "", "task_id": "e3c9e342-da4d-4230-bb9c-00495a7120b4", "status": {"code": 200, "text": "OK", "request_id": "b9f44ccf-df02-4d70-b727-59dc0442f2f2", "proc_id": "5584833c-ed27-4722-af99-e2d9f9267063"}, "statistics": {"processing time": 0.26708054542541504}}

“Dental Floss Refill” appears 3 times. but my code is only counting 1

The next image may have as the result “Dental Floss”, so the variable counting this attribute needs to be dynamic
Many thanks for your help

“Dental Floss Refill” appears in the “name” property in each list item. You can see the path to that property in the screenshot below from Best JSON Viewer and JSON Beautifier Online after I pasted in your JSON response.

So to get that property for each list item, you have to get the following properties from app variable JSON text (since that is the JSON object in your code):


Assuming there are a variety of list lengths (not always 3 items), you would need to do a for each item loop where the in list value would be the property “records[1]._objects” of app variable JSON text. And you would check to see if that value (in your code, the value is app variable seenproduct) is equal to “Dental Floss Refill.” If it is equal, you would increase the value of a variable by 1.

I have more info about JSON parsing here: API JSON Tutorial (Video).

Thank you, I will work through what you have written and check out your tutorial.
Truly appreciate your assistance

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