jacallan
Forms Fledgling

Simple Shopping Cart

We currently use a Nintex workflow start form in a list to create items in related child list. This requires the user to create items one at a time. I was able to prototype a simple cart that pulls in items from a catalog (lookup field) and adds them to a repeating section, but ran into issues when using variables to either parse a data field or to calculate and display an extended cost.

 

One calculation parses the unit cost from the item descriptor and displays it on the form. The second calculates the extended cost using that unit cost value and a user entered quantity and displays the result on the form.

 

Since the variables are re-used for each row, I am getting inconsistent behavior and unpredictable results ($0 saved with the item).  Is there a way around this, such as creating variables specific to each row, or somehow capturing the calculations in a more static way as items are added to the repeating section?  The alternative would be to ignore the calculations until post processing of the repeating section, but that would be less user-friendly.

 

Or... is there a better approach to the same problem?

0 Kudos
Reply
4 Replies
ahaaften
Cloud Wanderer

Re: Simple Shopping Cart

The accumulation should be possible using a calculated field outside the repeating section with a SUM function.

 

1a is the unit cost, 1b is the quantity and 1c is a calculated value 1a*1b.

The calculated value "Total" has the formula "SUM(1c)"

 

ahaaften_0-1597784460602.png

 

So if you can present the data on the form via a lookup field in the repeating section instead of saving everything in variables you can do direct calculations. 

 

Of course I'm not sure if it aids your situation, but hope it helps!

0 Kudos
Reply
jacallan
Forms Fledgling

Re: Simple Shopping Cart

Yes, thank you.  I had added an aggregation total outside of the repeating section which works great. There may be something in the way I've set the recalculation settings. The first 2 or 3 items appear to work correctly, although since I am displaying the calculated variable values, they are incorrect until the next row is fully populated and calculated. By the 4th item, all values go to zero and zeros are saved with the form in the repeating section multi-line text value rendering it useless.

 

I will try an alternative method to obtain the unit cost, as I currently parse that off the selected item lookup value using Regex. That would eliminate one variable and calculation. If your example then works for new rows, the aggregation total would be sufficient feedback for the user. I'll give it a shot.

0 Kudos
Reply
jacallan
Forms Fledgling

Re: Simple Shopping Cart

The approach I am taking provides the user with a lookup field (drop down) where they can select an item.  I am using a calculated value with "lookup" function to get the unit cost of the selected item.  The issue is that, after the first item, the lookup uses the next row and the next to calculate that value for all rows.

 

The selected item provides the unit cost in its description.  Is there a way I can parse out that value from the selection itself and have it retained as a value with its own row in order to calculate an extended cost?  What I get now, is the same value based on the selection of the last row entered applied to all rows.

0 Kudos
Reply
ahaaften
Cloud Wanderer

Re: Simple Shopping Cart

Can you maybe add a screenshot of how it looks?
0 Kudos
Reply