Creating a Function/Procedure with Parameters

Hi All

I’m working on an app and want to use a procedure with parameters (like Thunkable Classic and AI2). However, I can create the parameters for the procedure without any issues but can’t seem to find a way to use them. All the variables listed are app variables and unlike Classic/AI2 they don’t appear under variables in either the main menu or drop-downs. I also can’t find a way to use Local variables (only app).

Any help would be gratefully received.

Cheers, Stuart

On a function, click the gear, drag a parameter into the inputs and name it.

image

Then open your variables drawer and you’ll see the variable there:
image

Hi Paul

That’s what I would have expected to see but I don’t see anything I’ve created. I just tried it again, creating new parameters but I don’t see anything in the variables list - only existing app variables! I can see that it has worked for you but sadly not for me. You remember the issue I had with my blocks disappearing, I wonder if there are some other underlying issues with my account. Here’s something I’ve spotted too: “i” and “x” don’t belong in my app, as I haven’t created anything with those variables.

Cheers, Stuart

Can you send me a link to your project where its not working?

https://x.thunkable.com/projectPage/5be5c11926d7270edf3343f1

I clicked the gear on your GetParameters function, dragged a parameter called “lottoparam”, and then dragged out the lottoparam block from the variable drawer (it’s near the bottom, between i and x). It worked just fine.

https://x.thunkable.com/projects/5becb13ffe90d4739d8f9876/Screen1/blocks
Share link: https://x.thunkable.com/copy/5fdb1ee3da6a30b7a7fadf803299a7ce

Note: I know there is a bug that removes the assets selected in the asset block when you share a project. The fix is in the next release, but for now, if you do use the share link, you’ll need to set all of your asset blocks to get rid of the errors.

Hi Paul

I spotted something when I used your linked copy. When I created a parameter, the name I had chosen was capitalised (not what I had input) when I added it to the inputs block. I sorted that and hey presto it was in the variables list. You’ll note that I deleted an earlier reply because, I then went back and re-opened by copies and without doing anything, checked my Draw1 block with the parameters and then opened variables and noted that they were now there!

Here’s the image I attached in my deleted message:


and here’s two showing the parameters as they should be:
draw1
params2

Mysterious! Especially, why I’ve got the “i” and “x” variables, as they’ve come from nowhere after my blocks were restored and I can’t find anything so can’t delete them.

Cheers, Stuart

Hi Paul

Since my last reply, I’ve found out how to delete an unused/unwanted variable from the functions drawer, by selecting it from the drawer, then selecting it on the canvas, which gives me the option to delete the variable. Job done!

No need to worry about where the “i” and “x” came from, although that is a mystery because I never created anything with those.

Cheers, Stuart