Accessing selected data in repeatable listview

Hi All,

I seem to be pulling my hair out massively on this one, I have a repeatable listview and it's worked perfectly pulling the data from the DB and populating, however, I need to get each selected value of the drop-down boxes, I have read that temp states can be used but struggling to get them into an array.

Just seems really odd that you can't do selectbox[0].value to retrieve the value from the outside container, any help would be very grateful

Tim.

What do you mean by struggling to get them into an array? Do you have code samples or screenshots to explain a little more?

You should be able to set a state using the value of your query, then update that state with variable.setIn() (more here: Store temporary data with variables and localStorage | Retool Docs) when the select value changes. This keeps your data in sync with what's displayed and gives you a place to grab it from when you need to retrieve it.

Hey, thanks for coming back to me.

So within each repeated item, i have created a button that utilises "Set Variable" and then set it to the image below, however, i can't see that it sets the info in the variable.

Tim

Key path of the Set in function expects an array - maybe try [ {{ i }} ]

1 Like

Thanks for getting back to me, unfortunately nothing, If anyone has any suggestions on how to/ examples of how to extract a value from a repeatable listview really would be grateful.

Tim

Hi Tim,

Not sure what the issue is. Here's a small sample app demonstrating setIn working as expected.

Sandbox.json (12.9 KB)


Sandbox | Editor | Retool - 19 February 2024 - Watch Video

Have you tried tying to update action to change rather than using a button? I'm wondering if there's a problem when referring to a separate component rather than using self.value.

Also, have you confirmed that the variable itself is not being updated? There does seem to be a bug in the listView that can prevent it from updating the component state/value even when the underlying data object is updated: New repeatable not loading data when underlying data changes? - #5 by DoingMyBest

1 Like

Agreed with dcartlidge that [ {{ i }} ] should be working since the set in function expects an array. This is also dependent on the initial value of your variable. It would be helpful to see what you have for the variable's value on page load.

As far as calling selectbox[0].value, this is coming soon for the new list view :slightly_smiling_face: Another option in the meantime is to use the legacy list view since it does allow you to use selectbox[0].value. We won't be removing the legacy list view any time soon

1 Like

Hi @Tess - any update on when selectbox[0].value will be available on the new list view?

2 Likes