Merge a list & return a single item from that list

If my explanation below doesn’t make much sense, please let me know and I’ll send a recorded video explaining in detail, thanks

I have an app which I’m working on and I’m currently trying to display generate results in a CSV, here, English is not my first Language, please pardon my grammatical errors

So I have a data field called: ‘Stores’

I have another data field called: ‘Orders’ with these fields => orderID, amount, etc…

When an order is placed in a store, that order is added to ‘Orders’ as a single order item

That order is also added to a list ‘storeOrders’ in ‘Stores’ , obviously, ‘storeOrders’ hold every order of any Store in the system

The problem I have is this, when I try to generate a csv report, I’m not able to merge the orders, say for example

There are Orders [1, 2, 3, 4] in a store ‘storeOrders’, that’s 4 orders

I want to sum all the orders => amount, so that if orders[1, 2, 3,4 ] had these amounts [1: $20, 2: $60, 3: $5, 4: $100], the new amount value will be: $225

I’ve not been able to achieve this and I’ve been stuck for over 2 days :sleepy:

If my explanation below doesn’t make much sense, please let me know and I’ll send a recorded video explaining in detail, thanks

Just right off the bat I would abandon the Store’s storeOrders field. The list will get too big…

But it sounds like you just want to sum all the order amounts? Do Do a search for Order with a constraint Store = [The store you want] then after the search do :each item's amount:sum?

This topic was automatically closed after 70 days. New replies are no longer allowed.