Variable is not set

Hi
I’m using the following block to set a variable value to an item from a data viewer grid , So I can use it in the next screen as a parameter to filter an Api
Screenshot 2023-10-03 103159
And When running the code it give an api response of Null


Screenshot 2023-10-03 103610
The Api response is used to populate a local data source to be connected to a data viewer list
Any Fix for that

Any luck on Postman

What happens if you set app variable CategSelected to the value manually? For example, right above the set Categories_API's URL block, set it to a text string for the value you would have selected from the Data Viewer Grid. Does it work that way? If so, the problem is with retrieving the value from the data source. If not, the problem is with your API url.

Are you doing error checking for the API response?

@tatiang
dear , I’m not really sure that I understand you , but for the api I’m sure that It works fine

@tatiang here the API response , https://script.google.com/macros/s/AKfycbwlZpyS7fiWUsLiJ9Usa9lH_hCU04zJ-ATec-u-gt0ETYGW-dqNJW7CHT5qnv-l-v4V/exec?Category=food
And this without the parameter ,
https://script.google.com/macros/s/AKfycbwlZpyS7fiWUsLiJ9Usa9lH_hCU04zJ-ATec-u-gt0ETYGW-dqNJW7CHT5qnv-l-v4V/exec
Both Working Fine
So How I set them manually where I want a dynamic value from a list ,
I think There is something missing in the get value block

Can you share a link to your project?

@tatiang
https://x.thunkable.com/copy/05ee0fbfd20fd11dda745ac02ea57994

That link does not contain the blocks in the first screenshot so it’s harder for me to test it. One problem is that you appear to have initialized two variables with the same name so you’ll need to fix that by deleting one of them and re-checking your blocks for any missing variables:

@tatiang
I think I figured out the problem, the variable value is placed between a colon sign, which is not interpreted by the api server resulting in a response of null.
I find that out after creating a new row in Google sheet containing the variable value so I was able to figure out the variable value,
I think the solution would be declare the variable value as text only without the colon sign

@tatiang
Sure I tried another way to declare the variable, thought the result is always the same

There is currently a glitch in which I reported that when you right click a valuable to create a “set variable block” or “get variable block”, it creates a second one in the list of variables. The variable that is created will always show as NULL. I hope this gets fixed soon as I’m sure a lot of users aren’t aware of this.

1 Like

The variable value are placed in quotation mark

@tatiang
here is the new link
https://x.thunkable.com/copy/666237e9ed96e3e057d240ece29de32f
the point is the values resulted from the API response are place automatically in quotation mark making it useless as API Url Parameter And causing the data viewer list unable to display images from the corresponding URL as it placed in quotation mark as you can see from that block


Screenshot 2023-10-04 205857
So how to remove the quotation mark from the values from the API response

@tatiang
you can try it yourself , placing an image URL in Quotation mark , make the data viewer list unable to display that image , if you remove the quotation mark the images are displayed as usual

You can remove the quotation marks from the response using the Replace All text block: Text Blocks - Thunkable Docs.

Just replace " with an empty string (leave the third box blank). Like this:

@tatiang
Thanks @tatiang it really worked fine, your help is indispensable.

1 Like

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