# Variable is not set

**URL:** <https://community.thunkable.com/t/variable-is-not-set/2625200>\
**Category:** Questions about Thunkable X\
**Created:** [October 3, 2023, 7:36am UTC](https://community.thunkable.com/t/variable-is-not-set/2625200 "2023-10-03T07:36:59Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![minamaestro2023kg](https://avatars.discourse-cdn.com/v4/letter/m/e19b73/32.png) [@minamaestro2023kg](https://community.thunkable.com/u/minamaestro2023kg)\
**Post date:** [October 3, 2023, 7:36am UTC](https://community.thunkable.com/t/variable-is-not-set/2625200/1 "2023-10-03T07:36:59Z")

</div>

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](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/4/b44408f2eef751baf9206593c97328cd07f18944.png)  
And When running the code it give an api response of Null

 ![Screenshot 2023-10-03 103455](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/1/51d8159a80affbb69d27b1b5e477d0d0c87c91bf.png)  
 ![Screenshot 2023-10-03 103610](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/c/3cdb395233d708ca07dd9c0971f932eebd467464.png)  
The Api response is used to populate a local data source to be connected to a data viewer list  
Any Fix for that

---

<div class="post-metadata">

**Author:** ![vishruth-ram](https://avatars.discourse-cdn.com/v4/letter/v/82dd89/32.png) [@vishruth-ram](https://community.thunkable.com/u/vishruth-ram)\
**Post date:** [October 3, 2023, 11:55am UTC](https://community.thunkable.com/t/variable-is-not-set/2625200/2 "2023-10-03T11:55:26Z")

</div>

Any luck on Postman

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [October 3, 2023, 2:33pm UTC](https://community.thunkable.com/t/variable-is-not-set/2625200/3 "2023-10-03T14:33:38Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![minamaestro2023kg](https://avatars.discourse-cdn.com/v4/letter/m/e19b73/32.png) [@minamaestro2023kg](https://community.thunkable.com/u/minamaestro2023kg)\
**Post date:** [October 3, 2023, 6:04pm UTC](https://community.thunkable.com/t/variable-is-not-set/2625200/4 "2023-10-03T18:04:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![minamaestro2023kg](https://avatars.discourse-cdn.com/v4/letter/m/e19b73/32.png) [@minamaestro2023kg](https://community.thunkable.com/u/minamaestro2023kg)\
**Post date:** [October 3, 2023, 6:13pm UTC](https://community.thunkable.com/t/variable-is-not-set/2625200/5 "2023-10-03T18:13:59Z")

</div>

@tatiang here the API response , [https://script.google.com/macros/s/AKfycbwlZpyS7fiWUsLiJ9Usa9lH\_hCU04zJ-ATec-u-gt0ETYGW-dqNJW7CHT5qnv-l-v4V/exec?Category=food](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](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

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [October 3, 2023, 7:37pm UTC](https://community.thunkable.com/t/variable-is-not-set/2625200/6 "2023-10-03T19:37:50Z")

</div>

Can you share a link to your project?

---

<div class="post-metadata">

**Author:** ![minamaestro2023kg](https://avatars.discourse-cdn.com/v4/letter/m/e19b73/32.png) [@minamaestro2023kg](https://community.thunkable.com/u/minamaestro2023kg)\
**Post date:** [October 4, 2023, 7:42am UTC](https://community.thunkable.com/t/variable-is-not-set/2625200/7 "2023-10-04T07:42:50Z")

</div>

@tatiang  
[https://x.thunkable.com/copy/05ee0fbfd20fd11dda745ac02ea57994](https://x.thunkable.com/copy/05ee0fbfd20fd11dda745ac02ea57994)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [October 4, 2023, 8:27am UTC](https://community.thunkable.com/t/variable-is-not-set/2625200/8 "2023-10-04T08:27:36Z")

</div>

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:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/9/e9169dfbf1bd63e959a3118bd65cf484b6186d06.png)

---

<div class="post-metadata">

**Author:** ![drmina2007er0sjg](https://avatars.discourse-cdn.com/v4/letter/d/5daacb/32.png) [@drmina2007er0sjg](https://community.thunkable.com/u/drmina2007er0sjg)\
**Post date:** [October 4, 2023, 11:12am UTC](https://community.thunkable.com/t/variable-is-not-set/2625200/9 "2023-10-04T11:12:47Z")

</div>

@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

---

<div class="post-metadata">

**Author:** ![drmina2007er0sjg](https://avatars.discourse-cdn.com/v4/letter/d/5daacb/32.png) [@drmina2007er0sjg](https://community.thunkable.com/u/drmina2007er0sjg)\
**Post date:** [October 4, 2023, 11:13am UTC](https://community.thunkable.com/t/variable-is-not-set/2625200/10 "2023-10-04T11:13:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tthompson41231](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tthompson41231/32/161401_2.png) [@tthompson41231](https://community.thunkable.com/u/tthompson41231)\
**Post date:** [October 4, 2023, 1:29pm UTC](https://community.thunkable.com/t/variable-is-not-set/2625200/11 "2023-10-04T13:29:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![drmina2007er0sjg](https://avatars.discourse-cdn.com/v4/letter/d/5daacb/32.png) [@drmina2007er0sjg](https://community.thunkable.com/u/drmina2007er0sjg)\
**Post date:** [October 4, 2023, 1:41pm UTC](https://community.thunkable.com/t/variable-is-not-set/2625200/12 "2023-10-04T13:41:12Z")

</div>

The variable value are placed in quotation mark

---

<div class="post-metadata">

**Author:** ![minamaestro2023kg](https://avatars.discourse-cdn.com/v4/letter/m/e19b73/32.png) [@minamaestro2023kg](https://community.thunkable.com/u/minamaestro2023kg)\
**Post date:** [October 4, 2023, 5:59pm UTC](https://community.thunkable.com/t/variable-is-not-set/2625200/13 "2023-10-04T17:59:55Z")

</div>

@tatiang  
here is the new link  
[https://x.thunkable.com/copy/666237e9ed96e3e057d240ece29de32f](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 205735](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/e/4e3c1136eecbc6022890fc8d3486ec7fc31fec6d.png)  
 ![Screenshot 2023-10-04 205857](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/4/44609cc6f5b2405b7c64ada2459cbbd0a5846ded.png)  
So how to remove the quotation mark from the values from the API response

---

<div class="post-metadata">

**Author:** ![minamaestro2023kg](https://avatars.discourse-cdn.com/v4/letter/m/e19b73/32.png) [@minamaestro2023kg](https://community.thunkable.com/u/minamaestro2023kg)\
**Post date:** [October 4, 2023, 6:03pm UTC](https://community.thunkable.com/t/variable-is-not-set/2625200/14 "2023-10-04T18:03:18Z")

</div>

@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

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [October 4, 2023, 9:20pm UTC](https://community.thunkable.com/t/variable-is-not-set/2625200/15 "2023-10-04T21:20:47Z")

</div>

You can remove the quotation marks from the response using the Replace All text block: [Text Blocks - Thunkable Docs](https://docs.thunkable.com/blocks/blocks/text#replace-all).

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

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/0/7053794a266424d8660226ff5e8a37d0ef2fa485.png)

---

<div class="post-metadata">

**Author:** ![minamaestro2023kg](https://avatars.discourse-cdn.com/v4/letter/m/e19b73/32.png) [@minamaestro2023kg](https://community.thunkable.com/u/minamaestro2023kg)\
**Post date:** [October 6, 2023, 9:27am UTC](https://community.thunkable.com/t/variable-is-not-set/2625200/16 "2023-10-06T09:27:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [January 4, 2024, 9:27am UTC](https://community.thunkable.com/t/variable-is-not-set/2625200/17 "2024-01-04T09:27:23Z")

</div>

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