I’m stumped. Hoping someone can point me in the right direction.
I have a Repeating Group (RG) of “ThingA”. In this RG is a textbox used to the capture changes in quantity of ThingA (the RG has an Up and Down arrow in each cell to increase and decrease the quantity). Outside of the RG is a button, which, when pressed is meant to kick off a workflow that iterates through the RG’s list of ThingA’s, capture each ThingA ID and its associated textbox quantity. During this iteration through each cell, the ID and the quantity should be used to create a new/different Thing (“ThingB”). The end result should be a list of new ThingB’s (only when quantity > 0) with the ThingA ID, quantity, and some other info. The list of ThingB’s created in this process will never exceed 20.
I’ve looked at recursive workflows, client side java and plugins, but haven’t seen a sure fire way to do this. I keep running into challenges getting the quantity textbox data out of each RG cell. Is there an easier way to accomplish this that I’m simply not aware of?
Great question. No, I am not saving the quantity to ThingA. I am capturing the value of the quantity using a workflow that increments a custom state of the quantity textbox, but it is not saved to ThingA. It only needs to be saved to ThingB.
Hmm I think if it were me. I would create thingB when I add to the quantity and remove it if I subtract from it and it is 0.
Would that work for your situation?
Or, as another suggestion. Create a new list of thingA’s, copies of the originals, to load the repeating group. Then save the actual value on these copies. Then use those instead and delete the ones that are 0 after they select the ones they want. Maybe you don’t even need a thingB potentially.
I thought about creating/increasing/reducing ThingB on each click, but:
Was concerned about making too many calls back and forth to the database with each increase/decrease click
2… Need to append/include additional information in ThingB that isn’t conducive to putting it all in ThingA.
For context:
ThingA is like an order details RG, in which one can adjust the quantities of what they want to order
ThingB is an order, which will have not only the associated list of ThingA’s but also other information about the order itself (time, comments, fulfillment etc).
The workflow (with the click of a single button) create ThingB (order) and associate it with the multiple ThingA’s, then say Thank You and redirect to another page altogether.
It makes sense in my head, but executing it this way has proved challenging.
Hmm , maybe you can create a new temporary datatype that is lighter and that allows you to connect TypeA with it and then just change the quantity on that. Then pass that along to create ThingB’s on a backend workflow.
This has helped me think it through. The easiest and probably most effective way is to rethink my data model a little bit, and make the addition/subtraction of quantities less dependent on increasing/decreasing one at a time, rather, using a dynamic dropdown, which when changed, updates the associated ThingA. I can capture the ThingB data separately once the button outside the RG is clicked. Is there a fast an easy way to set a dropdown box to show a list of numbers from 0 to MaxQuantity (pulled from a database)?
There is the toolbox plugin that has a listOfNumbers feature. Then you can use that to drop in dynamic data. That’s probably the best way. Does that help?
Yup. Forgot I had that element included. I’ll put it to use again along with an “update” button/icon to commit the change after a quantity has been selected.
This ought to do it. Sometimes just need a different perspective on the problem. Thanks so much!