Unable to perform a roll up on a query column sourcing from a big table

Hey all, I am struggling with this issue:

I have an app that is to be built as my company’s ERP.

My sales order table is a glide big table. There are certain math columns within it that help calculate the totals for each items.

It turns out, that roll ups are not possible of a glide big tables computed column. I was under the impression that if I were to query the target big table rows, and then perform a roll up on the computed column of those rows, via the newly made query column, I would be able to bypass this issue.

Yet, I am unable to perform a roll up with or without the helper query column on any computed columns within another Glide big table.

Please help.

Yes, that’s a known limitation that is unlikely to change anytime soon.

The way I work around this is to save the computed values into non-computed columns when the rows are added. Not ideal, but that’s the only workaround that I’m aware of.

2 Likes

Hey Darren, thank you for the quick reply.

So my current workaround is exactly what you mentioned:

  1. For any big table, I create a copy of that big table with all the same columns as its original version, with one exception: the computed columns of the original table are non computed columns in this copy. So every time a row is added, it then adds one more row in the copy.

The problem with this is that the updates double :frowning:

Also, another problem I am facing with big tables is this:

My inventory for each product is calculated by rolling up the quantities from another table that logs any modifications to product as such: {‘product_id’:‘1234’,‘warehouse_id’:‘2hwned’,‘quantity’:-100}.

The JSON is representing the row values and column names.

Because I have my inventory structured this way, my products are always able to roll up their warehouse wise quantities. I had tried to go down the increment number route but it was too risky with big tables because of the issue of user concurrency, even worse than normal glide tables as glide big tables do not auto-update without a page refresh or a query reload.

Anyway, now due to this structuring, I am facing a new problem: If I want to have a page in my app that shows me a list of products with inventory levels below their re-order levels, I am unable to do so.

Do you have any solutions on how to proceed with this?

@Darren_Murphy

Why bother with a copy? Why not just write the values into non-computed columns in the first place?

Not sure I fully grasp the challenge. Can you add some screenshots of the tables involved to help me get a better visual?

2 Likes

That actually makes sense as well. I was initially worried about the creation of too many columns so i had gone with this method. Now, considering the efficiency of a Glide Big Table, it won’t really matter how many columns it has to hold.

As for the second problem i was facing, I am explaining it below with the help of screenshots and text.

In my app, there is a big table called the product activity master. This table is designed to keep of log of any modifications done to any product’s inventory. Each row will capture the product ID, warehouse where the product was added or removed from and the effective quantity.

Now, in my product master, which is a glide big table holding all my product details like images, product codes, prices and sizes, I am calculating each product’s inventory like this:

  1. First, for each product in my product master, I am relating the each row to the product activity master, allowing for multiple relations. Once I do this, i can essentially see a list of rows for each product that will show me everything that has happened to my product’s inventory.

2)Next, I am querying those relations to the product activity master with a query column, so that i can filter the rows from the product activity master for a specific warehouse.

  1. Finally, I am using a roll up column on that query column to sum up the total outstanding inventory value of that product.

The problem: Due to the way I have structured this, I cannot filter my products anywhere by their inventory.

A simple use case where I would require this would be:

  1. I want to see a list of products whose inventory value is below the set purchase order level. Example: Product A has 15 pieces in stock but the minimum quantity to maintain in stock is 50 pieces.

If i ever wanted to gather such a list of products, it would not be possible with this type of architecture.

The only way i could avoid this problem is by changing my inventory by incrementing numbers and having the inventory values as actual numbers existing in columns instead of just being calculated… This becomes very risky in a Glide Big Table because:

  1. They do not auto-update unless the query is reloaded or the page is refrshed.

  2. Glide does not have a way of avoiding the ‘race - condition’ that occurs when two users concurrently try to change a single value at the same exact time.

  3. I also tested this out in a dummy app, where I tried to increment a number in a glide big table, about 1 second apart from two different devices: Glide just set the column values for that product of the latest response it received.

If user one incremented the stock of 100, by 5 and then user two incremented that same stock by 3, only one second after the first user, then glide just ended up showing the stock to me as 103, instead of 108. The +5 increment from the first user was lost.

@Darren_Murphy

How do you write the values into a non-computed column?

I think you can use a set column action to do it, but maybe add a wait action for some seconds to make sure the calculated columns have finished calculating.