This is my arrangement. Whenever the button is tapped, a random value have to be disolayed in the title.
Now, I know this can be done by binding it with a page variable. But the same solution can’t be used for repeated items. So, is there any way to do it with component properties??
Marketplace: “set component property” flow function.
Note that with a repeated list this will set the value for every item in the repeat… So you might be better of with a set variable flow and a formula that updates only the required item. For example “SET_ITEM()”
I have a list of 10 items, can you give me an example as to how i can do that?
If this is not ideal, is there any way that would allow me to set the value for a button label on a repeated list item?
Let’s say you want to change the label of the currently tapped button:
on button tap event add a logic that “set variable” depending on your repeated variable.
As for the formula, something like this would do:
SET_ITEM(pageVars.yourList, item.id===repeated.current.id, SET_KEY(repeated.current, "label", "whateverYouWantItToBe"))
This of course implicates that the items that you repeat with have an “id” field and a “label” field. You’ll need to update this formula to match your specific use case.
Cheers
Hey! Thank you so much!!!
I’m getting closer to it. Just one more step
This is where I’m at now:
- I have a page var named actionsInProgress
- I have a dataset which has both the id and label properties
-sample repeated data:
{
“id” : 1,
“label” : “firstOne”,
}
ScreenShot 1:
This is how it looks like.The label property is repeated.current.fields.id.stringValue
When each button is tapped, I want to change it, so that it displays “something”
Can you please guide me through that?
oh, in this case you need to best the set_key into another set_key.
Something like this:
SET_ITEM(pageVars.yourlist, item.id==repeated.current.fields.id.stringValue, SET_KEY(repeated.current, "fields", SET_KEY(repeated.current.fields, "id", SET_KEY(repeated.current.fields.id, "stringValue", "yourNewValue))))
Why so? Because you in fact need to change the stringvalue and only that, not the top level property. please test this approach and let me know if it works for your case.
Perfect! Just one more clarification, where should I enter this formula?