Forum Academy Marketplace Showcase Pricing Features

Basic Data Manipulation

I’m trying to do some fairly basic data manipulation, but struggling no end trying to work it out…

Let’s say I have a data type called ‘stock’ which stores all the stock for all my merchants:

Stock

I then have an order query, like the following (this is a list but I’m using a table to represent it):

Query

From here, I want to return how much of each stock type my merchants have, and display that in a repeating group, grouped by merchant:

Repeating Group

Of course, this isn’t my actual scenario, but a neat way to represent it. Any help would be greatly appreciated!

@SJL

Basic dB structure:

Product
Title (text)
Price (number)
Stock qnty (number)
Merchant (merchant)

Merchant
Title (text)
Products (list of products)

Order
Title (text)
Line item (list of line items)

Line item
Product (product)
Quantity (number)

The above should facilitate all the tables listed

Thanks @cmarchan , however, as mentioned, this is not my actual scenario, just a neat way to describe it.

I need to do exactly what I described, without changing the database.

@SJL

The dB structure is crucial for things to work. It is usually 50% of the app.

I laid out a reference structure.

Best of luck with your app :+1:t2:

You’re 100% correct there - the DB structure is crucial! (that’s why I can’t change it)

Nevertheless, I figured it out in the end.

For the repeating group, my data source is the search for ‘stock’, grouped by ‘merchant’. Then I have a nested repeating group inside that where my data source again is search for ‘stock’ with constraints (1) ‘fruit’ is in ‘order’, and (2) ‘merchant’ is current cell’s grouping’s ‘merchant’.

Now I just have to figure out how to (a) hide merchants with 0 stock and (b) sort by the merchant with the most stock