"~Donation - $25~1~25.00~~~~Amalia Jones - 301|~All Recipes~1~15.00~~~~Amalia Jones - 301|~Buttery Caramel~1~18.00~~~~Amalia Jones - 301|897-332~Peanut Butter Cups~1~12.00~~5325~~Bobby Jones - 285|~Chocolate Chip Cookie Dough~1~20.00~~~~Amalia Jones - 301",
The individual Order Items are delineated by “|” so I can make a list from text that now contains the individual order items
A single item in the list would be
"~Donation - $25~1~25.00~~~~Amalia Jones - 301"
I can then split this list on “~” to get quantity (1), amount (25.00), person (Amalia Jones - 301), etc. as individual elements
If I now want to sum all the amounts and quantities for each person so I end up with the following data available: Name / QuanitySum / Total
Amalia Jones - 301 / 4 / 85.00
Bobby Jones - 285 / 1 / 12.00
Any suggestions? I could put it into a table, and ask the DB to do the math for me. Does that introduce execution risk by going to the db to insert and then back again for the sums?
The data represented in the string is the items in the order and the Seller who should get credit. There could be:
One to n order items and
one to n sellers
I need a total of all the order item quantities and dollars by Seller.
In another language, I might dynamically set an array key to the seller name and increment up the value that way. I don’t think objects can have dynamic key names in Backendless.