I am searching a local data source via SKU and pulling row information into variables - SKU, Item, Price, Qty.
I concatenate these variables separated by a comma to create a CSV string and then store that in a variable. I then add that variable to the bottom of a list and display it in a List Viewer which serves as a shopping cart.
Once I have completed adding to the cart, I want to cycle through the list, and explode each line and save each component into variables which I then add to a Sales table.
My problem is that I cannot figure out how to explode the data in the list line item.
Remove the list [gear] block. That block makes anything to the right of it into a list. But your variable is already a list so that block is creating a list of lists which is generally a bad idea. There is almost never a reason to use that block except when initializing list variables.
I would use a single data source for these two operations rather than using a local data source for one and a list for the other. You can “flag” rows added to the shopping cart and then just display those.
There was a slight error in your last block (object should be rowOject and not j) and I also added a for each item so that the app iterates through the shopping listview variable and adds each item to the Sales table.
I think you better double check your code. Your variables might be different, but it was 100% working the way I did it. You are iterating through a list where J represents the current item. You are currently cycling through a list, but reusing the same variable (rowObject) without changing it.
Correct - j is the current item for the count but the object with the properties is rowObject. Have checked and it is working fine - populating my sales table.
Great, I’m glad that worked out for you. If you have any other questions let me know.
P.S. I’m still baffled that your code is working like that. When you add a bunch of different items does it repeat the same item over and over in your table?
Haha, Understandable. The list needs to contain objects.
You can create two lists. One is for you to view, and the other is hidden and contains all the data - shoppingCart, listOfObjects, or whatever you want to call the variable list.
In my example above, when a user adds something to the cart it gets the product info, then adds a new property called “Quantity”, and adds that to the object list.
When you checkout it will extract the data from the objects and store it your table. Variable “J” will be the object currently being exported.