BDK Repeating Group plugin question - Can I replace an empty input with a zero?

Hi. I’ve looked in depth through the forums for a solution, and this seems like something that should be possible, but I cannot figure this out.

Lets say I have a repeating group that displays entries from the database, along with input boxes that show the count for each item. The values are in a list below from the RGData group. In a workflow, I create a new DB entry for each identity with the specific value from this list by referencing the index.

The issue I am having is when a user removes the value from a given input box, the value disappears from the list (instead of a 0). See below:

Now, when I use this same workflow to write the DB values, since there is only 4 entries in the values list, new entries in the DB are created like this:

Non-binary = 4
Prefer not to say = 5
Other = 2
Female = 3
Male = null

vs the desired outcome

Non-binary = 4
Prefer not to say = 5
Other = null (or zero)
Female = 2
Male = 3

Is there any way to force a null input value to be zero, or keep the null value in the correct position so that the list looks like this:

Values: 4, 5, 0, 2, 3
Thanks in advance!

Could you try playing with Conditions on the field’s Initial Content to display a 0 if the count/sum is Empty or <1?

Hi there @msgiblin ! I appreciate the response. This actually does work for to display the initial content, however, if the user then deletes the 0 that is initially in the field, they can still delete it and leave it blank, which gets me right back to the same issue

image

Is there a reason the user has edit access to the subtotal fields in a way that allows them to delete the value?

I think I am not being clear about what’s happening.

There are 5 input fields , each of which are free for the user to change at any time.

With the BDK repeating groups plugin RGData component, you can get access to each value in the inputs as a list.

As you change the values in the input, the list is updated, so for example if in the input boxes on the form I add these values,

Non-binary = 4
Prefer not to say = 5
Other = 2
Female = 3
Male = 6

RGData list is the following 4, 5, 2, 3, 6

If I remove one of values like this (say, Other delete the 2):

Non-binary = 4
Prefer not to say = 5
Other =
Female = 3
Male = 6

the RGData list is now 4,5,3,6.

The issue that arises for me is when I cycle through this list and write the values in the DB what is getting recorded is the following, which effectively pairs the wrong numbers with the wrong values (shifted to the left once)

Non-binary = 4
Prefer not to say = 5
Other = 3
Female = 6
Male = null

Ah I understand now - I had thought these fields were subtotal from another form but see what you’re trying to do.

Would you be able to use Autobindong instead? I fear by storing all of the numbers on a single field as a list will cause you to run into more issues down the line. If you added all 5 fields as separate columns on the data type, you can save each of these to their respective field.

Great idea! I was auto-binding as suggested to use this in some repeating groups, however, there are some repeating groups I have where I would like to create a new entry upon each submit in order to keep tracking of all previous values.

I’m still at a loss for the cases where I need to create a new entry each time as opposed to updating the existing ones

1 Like

@gaurav any ideas on this one?