# Need help in creating a variable

**URL:** <https://forum.getodk.org/t/need-help-in-creating-a-variable/43237>\
**Category:** Support\
**Tags:** form-design, odk-aggregate, odk-xlsform\
**Created:** [September 27, 2023, 12:01pm UTC](https://forum.getodk.org/t/need-help-in-creating-a-variable/43237 "2023-09-27T12:01:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ricard\_Hoxha](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ricard_hoxha/32/21159_2.png) [@Ricard\_Hoxha](https://forum.getodk.org/u/Ricard_Hoxha)\
**Post date:** [September 27, 2023, 12:01pm UTC](https://forum.getodk.org/t/need-help-in-creating-a-variable/43237/1 "2023-09-27T12:01:19Z")

</div>

i have to create a hidden variable as my client wants. which means i need to create the xlsform should create a variable automatically.  
logic. before i create this variable we ask the respondents the first brand that comes to their mind. then a multiple choices question of the other brands that come to their mind. then we read all the remaining brands and ask them if they know them. now i need to create a hidden variable because i will use it later on as a condition. for example later on i should ask questions only for banks which are part of the fam\_aware variable. does anyone know how can i solve this request by the client? if you need more information please ask.

HIDDEN VARIABLE  
PURPOSE:Holds brands AWARE to be used at subsequent questions.  
SCRIPTER: RECORD BRANDS WHICH WERE MENTIONED AT ANY OF THE FOLLOWING: UN\_AWARE FIRST MENTION, UN\_AWARE MENTIONED, FAM\_AIDED

---

<div class="post-metadata">

**Author:** ![danbjoseph](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/danbjoseph/32/21901_2.png) [@danbjoseph](https://forum.getodk.org/u/danbjoseph)\
**Post date:** [September 29, 2023, 6:41pm UTC](https://forum.getodk.org/t/need-help-in-creating-a-variable/43237/2 "2023-09-29T18:41:20Z")

</div>

If you want to refer to an an answer from a previous question you can use the question name to use the answer as a variable. See: [https://docs.getodk.org/form-logic/#variables](https://docs.getodk.org/form-logic/#variables)

Here is an example of one list of options, that is filtered for a second question based on what was selected in the first.  
[filter-example.xlsx](https://forum.getodk.org/uploads/short-url/xGq7IDWh6PkC0WsIimErlWqHxeq.xlsx) (12.8 KB)

 ![Screenshot 2023-09-29 at 2.37.45 PM](https://getodk.b-cdn.net/uploads/default/original/3X/1/c/1c00018a1158c7aa91e3ca4933fcf141c003c1de.png)

Here is an example of a repeat group that repeats for each answer from a select\_multiple.  
[repeat-loop.xlsx](https://forum.getodk.org/uploads/short-url/aRCYYwWDZc7mC0fbyOFyUs8iqlj.xlsx) (16.8 KB)

 ![Screenshot 2023-09-29 at 2.39.52 PM](https://getodk.b-cdn.net/uploads/default/original/3X/3/6/3639b90d160194890178d730de89aef3113ca297.png)

Also, I noticed you tagged your post with `odk-aggregate`. If you are using Aggregate, please note that it has reached end-of-life and is [no longer being updated or supported](https://forum.getodk.org/t/aggregate-is-no-longer-being-updated/33742). Consider switching to [Central](https://docs.getodk.org/central-intro) because it's actively developed.

---

<div class="post-metadata">

**Author:** ![Ricard\_Hoxha](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ricard_hoxha/32/21159_2.png) [@Ricard\_Hoxha](https://forum.getodk.org/u/Ricard_Hoxha)\
**Post date:** [October 4, 2023, 12:07pm UTC](https://forum.getodk.org/t/need-help-in-creating-a-variable/43237/3 "2023-10-04T12:07:35Z")

</div>

its more complicated thatn that.  
we ask three questions with a list of brands  
question\_1 (here we ask for the first brand that comes to the respondents mind without reading him the brand list)  
question\_2 (here we ask for other brands(excluding the one he responded at question\_1) again where we dont read to him the brand list)  
question\_3 (here we ask for all the brands the respondent knows(excluding those at question\_1,question\_2 and question\_3) and reading the brand list)

now i need a variable or maybe another solution so i can save all this answers from this questions in one variable called fam\_aware maybe. you may think why do i need this. well i will have to ask 15 questions to all the brands answered at questions 1,2,3.  
for example i will have to ask the question how much do you like this "brand"?(i need this question for all the brands answered before)
