Mismatch between Cell Index & Input Value

I have an input in a Repeating Group with an initial value of zero, in which the user can enter values. I need to access the updated values from the RG.

I am trying to use the BDK plugin, however have run into an issue whereby Bubble doesn’t retain the input at the correct index position. The problem arises when the input cell doesn’t have a value.

For example, in the first screenshot below, the values map fine:

But in the screenshot, when the second input is empty, the inputs are extracted at the wrong index position:

Any ideas, how I could deal with this. I am not sure if there is a way for bubble to retain a default value in an input cell if the user leaves it empty. I have tried with conditions but couldn’t make it work.

One way could be to add a button which the user has to press, which triggers a workflow and fills the ‘invalid’ with zero values - but wondering if there is a better way. I am new to Bubble and still finding my way through.

I haven’t tried this as I’m answering from a phone, but try the following:

Create a custom state in the input, of type number (not list). And add the following WF:

When the input value is changed:
Step 1 - assign the input value to the custom state (only when the input value is valid);
Step 2- assign an empty value to the custom state (only when the input value is invalid);
Step 3- reset the input

And the following conditionals in the input:
1 - If custom state is not empty: Initial value = custom state value
2 - If the custom state is empty: Initial value = 0

1 Like

Thanks @Newed

I haven’t been able to make it work as yet. I am setting the value for the custom state as 0, when input isn’t valid but when I access the data - its just the non zero values which are being accessible and thus they lose their index position.

I will keep investigating. You have given me an approach to think about!

Hi @SK1,

I think there is a way to make it work; I added a second step after the update step in the workflow that runs when the input’s value changes:

see?
ezgif.com-gif-maker (5)

I tested it and it worked for me but I’m not sure it fits your use case because it updates the actual value in the dataset to 0 when the input is left empty.