# Functions with dropdown for j i list or variables

**URL:** <https://community.thunkable.com/t/functions-with-dropdown-for-j-i-list-or-variables/1663537>\
**Category:** Questions about Thunkable X\
**Tags:** variables, list, function\
**Created:** [January 1, 2022, 1:32am UTC](https://community.thunkable.com/t/functions-with-dropdown-for-j-i-list-or-variables/1663537 "2022-01-01T01:32:43Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![overshield](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@overshield](https://community.thunkable.com/u/overshield)\
**Post date:** [January 1, 2022, 1:32am UTC](https://community.thunkable.com/t/functions-with-dropdown-for-j-i-list-or-variables/1663537/1 "2022-01-01T01:32:43Z")

</div>

Could we get this for variables please?

Where I could create and name a list of functions I have created and call on ‘j function’ for example

I don’t have a github or any of that, not sure how all that works or if this is considered a feature request idk…

Thanks

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/b/4b9a104395ebb420f430d0c6c23d026c85f23472.png)

---

<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:** [January 1, 2022, 3:31am UTC](https://community.thunkable.com/t/functions-with-dropdown-for-j-i-list-or-variables/1663537/2 "2022-01-01T03:31:38Z")

</div>

I don’t understand what you are wanting. Are you asking for a loop that runs a function with a variable value that is different each time?

Can you give a concrete example of how this would be used? What is a real life example?

You can submit feature requests here:

> **[Bugs and Feature Requests](https://docs.thunkable.com/bugs-and-feature-requests)**

---

<div class="post-metadata">

**Author:** ![overshield](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@overshield](https://community.thunkable.com/u/overshield)\
**Post date:** [January 1, 2022, 3:59am UTC](https://community.thunkable.com/t/functions-with-dropdown-for-j-i-list-or-variables/1663537/3 "2022-01-01T03:59:47Z")

</div>

Hopefully this makes sense, lemme know if you have questions

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

---

<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:** [January 1, 2022, 4:13am UTC](https://community.thunkable.com/t/functions-with-dropdown-for-j-i-list-or-variables/1663537/4 "2022-01-01T04:13:57Z")

</div>

Okay, I understand, sort of. It’s still not a real world example but the screenshot makes sense. You want a function that can be called from a list of functions. I haven’t needed that before but if it’s important to you, submit a feature request and include a link to this topic.

I’d rather have a [Case statement](https://www.w3schools.com/sql/sql_case.asp) block. I can see all sorts of uses for that.

---

<div class="post-metadata">

**Author:** ![overshield](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@overshield](https://community.thunkable.com/u/overshield)\
**Post date:** [January 1, 2022, 12:28pm UTC](https://community.thunkable.com/t/functions-with-dropdown-for-j-i-list-or-variables/1663537/5 "2022-01-01T12:28:29Z")

</div>

How is a case statement different than

if, else if, else if, else?

This seems less efficient for a situation like mine where I have to create a new else if to my blocks if I add a new function for some reason.

In my example I just create a new function, add it to my list of functions, and then my existing for each item j block will automatically pick it up and do it’s job.

A real world example is I have functions that run depending on a random number.

If RNG returns 1, then run Fx1  
If RNG returns 2, then run Fx2

And so on.

I don’t want to build an if block with if, else if1, else if2, else ifₙ, (where ₙ could be 100). Then I have to add the function manually underneath

I’d much rather append a list of functions and list of circumstances and let my for each, or count by i blocks handle it automatically.

---

<div class="post-metadata">

**Author:** ![sketch](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/sketch/32/109058_2.png) [@sketch](https://community.thunkable.com/u/sketch)\
**Post date:** [January 1, 2022, 1:35pm UTC](https://community.thunkable.com/t/functions-with-dropdown-for-j-i-list-or-variables/1663537/6 "2022-01-01T13:35:58Z")

</div>

Functions have a mutator( blue Gear icon )  
If you simply click it a pop up appears and you can add input fields.  
Then in the execute function block the input Will appear where you can add your variable “j” block.

See functions docs: [https://docs.thunkable.com/functions](https://docs.thunkable.com/functions)

-Luke

---

<div class="post-metadata">

**Author:** ![overshield](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@overshield](https://community.thunkable.com/u/overshield)\
**Post date:** [January 2, 2022, 11:18am UTC](https://community.thunkable.com/t/functions-with-dropdown-for-j-i-list-or-variables/1663537/7 "2022-01-02T11:18:20Z")

</div>

I may be wrong but I don’t believe that solves the request I’m having.

Are you saying you can make a list of functions you’ve created? And then call on one of them programatically from a for item j, or a count by i block?

---

<div class="post-metadata">

**Author:** ![sketch](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/sketch/32/109058_2.png) [@sketch](https://community.thunkable.com/u/sketch)\
**Post date:** [January 2, 2022, 12:00pm UTC](https://community.thunkable.com/t/functions-with-dropdown-for-j-i-list-or-variables/1663537/8 "2022-01-02T12:00:20Z")

</div>

Yeah Just Place the function caller inside the loop.

---

<div class="post-metadata">

**Author:** ![overshield](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@overshield](https://community.thunkable.com/u/overshield)\
**Post date:** [January 2, 2022, 12:43pm UTC](https://community.thunkable.com/t/functions-with-dropdown-for-j-i-list-or-variables/1663537/9 "2022-01-02T12:43:20Z")

</div>

I’m getting this error when I try to add my functions output to a list.  
Do you have an example of how to set this up?

Thanks

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/a/1a4a1cb6adf47e06c9d285a2d2e9bb2283060486.png)

---

<div class="post-metadata">

**Author:** ![sketch](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/sketch/32/109058_2.png) [@sketch](https://community.thunkable.com/u/sketch)\
**Post date:** [January 2, 2022, 1:20pm UTC](https://community.thunkable.com/t/functions-with-dropdown-for-j-i-list-or-variables/1663537/10 "2022-01-02T13:20:18Z")

</div>

Why are your functions Orange they are supposed to be purple?

Also you cannot add functions to a list.

If that was What you wanted then I appologize for mis understanding.

---

<div class="post-metadata">

**Author:** ![overshield](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@overshield](https://community.thunkable.com/u/overshield)\
**Post date:** [January 2, 2022, 1:28pm UTC](https://community.thunkable.com/t/functions-with-dropdown-for-j-i-list-or-variables/1663537/11 "2022-01-02T13:28:18Z")

</div>

Idk, here’s what I have. I was testing some other things and that’s what the red2/green2/blue2 is

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

---

<div class="post-metadata">

**Author:** ![sketch](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/sketch/32/109058_2.png) [@sketch](https://community.thunkable.com/u/sketch)\
**Post date:** [January 2, 2022, 2:23pm UTC](https://community.thunkable.com/t/functions-with-dropdown-for-j-i-list-or-variables/1663537/12 "2022-01-02T14:23:56Z")

</div>

I still don’t Get it.

---

<div class="post-metadata">

**Author:** ![overshield](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@overshield](https://community.thunkable.com/u/overshield)\
**Post date:** [January 2, 2022, 2:29pm UTC](https://community.thunkable.com/t/functions-with-dropdown-for-j-i-list-or-variables/1663537/13 "2022-01-02T14:29:59Z")

</div>

Ok no problem, could you work out how you would go through this process, maybe I’m doing something wrong

---

<div class="post-metadata">

**Author:** ![sketch](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/sketch/32/109058_2.png) [@sketch](https://community.thunkable.com/u/sketch)\
**Post date:** [January 2, 2022, 3:03pm UTC](https://community.thunkable.com/t/functions-with-dropdown-for-j-i-list-or-variables/1663537/14 "2022-01-02T15:03:15Z")

</div>

The only way to do that is with if statements.  
Wich if i Read it right this time is not What you want right?

Once again My appologies for mis understanding.

---

<div class="post-metadata">

**Author:** ![overshield](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@overshield](https://community.thunkable.com/u/overshield)\
**Post date:** [January 2, 2022, 3:05pm UTC](https://community.thunkable.com/t/functions-with-dropdown-for-j-i-list-or-variables/1663537/15 "2022-01-02T15:05:32Z")

</div>

I’m not sure how you’re understanding it, based on my 2nd screenshot can you build what you believe is the solution and post a screenshot?

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [January 2, 2022, 3:33pm UTC](https://community.thunkable.com/t/functions-with-dropdown-for-j-i-list-or-variables/1663537/16 "2022-01-02T15:33:59Z")

</div>

does this work for you?  
[https://x.thunkable.com/projectPage/61d1c443ee9607020e0552d7](https://x.thunkable.com/projectPage/61d1c443ee9607020e0552d7)

---

<div class="post-metadata">

**Author:** ![overshield](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@overshield](https://community.thunkable.com/u/overshield)\
**Post date:** [January 2, 2022, 3:52pm UTC](https://community.thunkable.com/t/functions-with-dropdown-for-j-i-list-or-variables/1663537/17 "2022-01-02T15:52:13Z")

</div>

This seems to be on the right track yes,

What should I add to this last block to cause each Fx to execute depending on which button was pressed?

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/1/c15f8b9f6217ed9cbd5156884763a1f8cb012281.png)

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [January 2, 2022, 5:37pm UTC](https://community.thunkable.com/t/functions-with-dropdown-for-j-i-list-or-variables/1663537/18 "2022-01-02T17:37:54Z")

</div>

When there is a well, there is a way

Try this  
[https://x.thunkable.com/projectPage/61d1e1acff08e90011a5f12e](https://x.thunkable.com/projectPage/61d1e1acff08e90011a5f12e)

---

<div class="post-metadata">

**Author:** ![overshield](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@overshield](https://community.thunkable.com/u/overshield)\
**Post date:** [January 2, 2022, 7:56pm UTC](https://community.thunkable.com/t/functions-with-dropdown-for-j-i-list-or-variables/1663537/19 "2022-01-02T19:56:35Z")

</div>

I don’t think I see how this does what I’m wanting.

In my example from my previous screenshot I want the following:

For each item of the red/green/blue buttons, only that specific color Screen Fx should run

---

<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:** [January 2, 2022, 8:21pm UTC](https://community.thunkable.com/t/functions-with-dropdown-for-j-i-list-or-variables/1663537/20 "2022-01-02T20:21:14Z")

</div>

If you have the buttons in a row or column then you can check to see if they are #1, #2, or #3 in the list of buttons in that row/column using the “[find first occurrence](https://docs.thunkable.com/lists#find-first-last-occurrence)” block.

[Next page](https://community.thunkable.com/t/functions-with-dropdown-for-j-i-list-or-variables/1663537.md?page=2)
