Using one procedure for n buttons

In my app, I have a spinner into which I load a list of names through an API call. However, I created the buttons to select (always through a call) all the names that begin with the reference letter. What I'm asking is, do I have to write all the procedures regarding each single button, or is there a method to unify the procedures by passing only the variable letter to the API? Thanks in advance

Please show your relevant blocks, write out an example of what you want to achieve.

Certainly! Thanks for the reply. As I explained, in the load event of the screen, a 'Select From...' query is made and all the names are selected. Then, through the relative letter on the button, the query is changed to 'Where name Like...(letter)' and thus restricts the names in the spinner with those starting with the selected letter. Well, will it be necessary to write the same procedure for each single button or is it possible to combine them, modifying only the variable to be sent to the server? I hope I was clearer

You can use the same procedure. Get the letter from the button.text and substitute this in your query

You can also use the anyButton blocks to further reduce your block count. Make a like of the buttons if you want to exclude other buttons in your app.

Thanks Tima, I understood that I could do it, but I didn't quite understand the procedure I should follow. I would be grateful if you could give me an example

Like this ?

buildQuery.aia (2.4 KB)

Great! Absolutely great. It's just I need
Thank you so much

I know, that's incredible, but I cannot find the block
'When Any..."

Do I have to create it?

You need to have a button component already in the screen.

Either look for the Any section of the blocks pallete, or right click on a specific button event and change it to Generic.

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