Creation of multiple rows dynamically

I am trying to generate multiple rows dynamically upon form submission.

Does anyone have an idea for a workaround?

Here is my situation: I am manufacturing a product. To make the product I need multiple components.

I’d like to fill out a form with the quantity of the final product I would like to manufacture. It should then automatically create rows for each component that needs to be ordered to make this product.

Example: Product A is made up of 2x Component A, 6x Component B, 1x Component C

When creating an order for 1000 units of Product A I now want to automatically create the orders for the components.

So upon form submission for 1000 units of Product A. 3 Rows should be generated representing each Component A, B & C incl. their required quantity.

The following tables provide the foundation for this:
Products (id, name, components rel.)
Components (id, name, products rel.)
Product Orders (id, product name, quantity, component orders rel.)
Component Orders (id, component name, quantity, product orders rel.)

I need this to work dynamically since I have multiple products and the number of components per product varies. So the solution needs to be able to generate N number of rows into the component orders table upon form submission.

I recently created a free Page template for a simple BOM management, it is limited to the management of a maximum of 10 components for each level. There are 99 levels available, where at level zero there is the finished product.
Maybe it can be useful, I think it will be published shortly.
Check out this video:

4 Likes

I had to do something quite similar to this recently. In my case, I had to add anywhere between 1 and 52 rows of data from a single form submission, and the number of rows was not known in advance.

The solution I came up with was moderately complex, and involved a 3rd party service (Integromat), but it works.

I’ll describe it here at a very high level, and if you think it may be applicable to your scenario let me know and I can provide more details.

  • I started by creating a working (Glide) table with 52 rows. Each row was numbered from 1 to 51. (This was necessary as each row neeed to contain a timestamp, which incremented by one week for each row).
  • I then defined a JSON structure and built it out on each row, using templates and based on the submitted data
  • The required number of rows are combined into a collection using a joined list
  • The JSON structure containing the collection is sent to Integromat via a webhook
  • Integromat parses the JSON and inserts the rows into the Google Spreadsheet
4 Likes

Impressive work, and I like the 99 level logic introduced into it. Very intricate on how you spread the production right across the product line. Ideal for organisations in the primary and secondary sectors. I’m sure I can learn a lot from this. Thank you for this template.

1 Like

I had the same use case a while ago and built a structure to use with the Sheets API, I assume you use it as well. The plus here is that it takes only 1 Integromat node run versus whatever many rows you have (saying you insert 50 rows, it takes 1 from the quota opposed to 50).

1 Like

Thank you @Wiz.Wazeer :heart:
It was a bit of a bet with myself. Having in mind the novice user, I wanted to try to do everything in Pages, using only glide tables, without resorting to external services, not even using google sheets and not even experimental columns.
It seemed crazy not being able to use even actions that work on multiple relations (i.e. to upgrade multiple rows in one shot, delete multiple rows, etc. ), but instead it can be done, even if it is a bit complex and if it is a system that eats rows… but it is the method that I like, the one I have always implemented and which seems to me the most linear.

If you have any questions, I’m here :wave:

1 Like

I often have thé same need.
Works well with Zapier also, with a latency for data refresh and Sync
Since Yesterday, i am working on a solution with Apps Scripts and Webhook, works well really fast, a few lines of code. have not tested my data refresh issue yet

1 Like

@Roldy Wow, that is very impressive! This is pretty much exactly what I am looking for. I won’t be able to use your template, since I have other considerations for my built, but I would love to see the template and how the logic behind it is built. Is there any way to get access to it?

How do you handle the multiple row update when loading the Quantity of a final product? Is it fully done inside of Glide?

1 Like

@Darren_Murphy this sounds pretty complex and likely to break and difficult to change or update with the JSON structure.

@VVerhille I was also thinking about using Apps Script. I’m very familiar with it. Would you mind sharing the code of how you have set that up?

Yes, it is fully done inside Glide.
This is the trick: it’s a “fake multiple row”; in reality I have 10 single relations that are called into question by 10 “increment” action towards each sub-component that is potentially in the BOM of that component to be loaded. See this:

To get access to this template you’ve to wait until the template pubblication into the glide website. I know it’s approved but I’m not been able to see it in the gallery yet.

1 Like

P.S.
If you want to experience such a thing, remember this: when the single relation does not exist the flow of the action stops at that point.
So if there are 4 sub-components, only the first 4 increment actions will be performed and at the fifth action the flow will stop (in fact the final go-back action [which is almost not seen below in this photo] is practically never performed).

2 Likes

@Roldy I did find it actually, but not in Glide Pages, but in Glide Apps.

I was able to create my own copy.

Thank you for your explanation, but I don’t quite get it yet. I’ll take a look at the tables and browse around a bit. It does seem pretty complex!

Maybe we should request a Loop function in the action builder. That would make this much simpler!
It just has the risk for the glide servers to process endless loop functions :wink: (they’d have to time out after 3-5 minutes maybe)

1 Like

No! I wasn’t aware that it behaved that way, will definitely check it out.

1 Like

What makes you think it would be likely to break? It hasn’t broken yet :wink:

Sorry, I should have been more clear.

I may not be the only one working on the project.

So unless the other person also completely understands how it works and keeps it in mind while adding more functionality it may break.

But I guess all currently suggested solutions have that issue since they break out quite far from the basic Glide functionality.

1 Like

Thanks @Tobias

Please @SantiagoPerez can you check what happened? This template is for Glide Pages not Glide App.

If you’re familiar with apps script, then this is fairly straight forward. All you really need to do is write a single row to a working table, and then have a trigger take that and create the required number of rows in the secondary table (or tables).

I did this several months ago, not for myself but for @yinon_raviv. I’m not sure if he’s still using it, but perhaps he might comment on how well it worked - or didn’t work, haha :crazy_face:

When it came time to do it for myself (for another customer, actually), I deliberately tried to avoid an apps script solution as I figured it would be easier to maintain for somebody that wasn’t familiar with apps script.

Thanks for letting us know.

1 Like

We haven’t launch the app yet should be within few weeks.
All testing were successful so far and Darren’s script works great so far but when mass users start we’ll be smarter

Uuufff… amazing work @Roldy :trophy:

Reading the term “BOM” at the beginning I was confused, I knew that I had seen something like this and remembered my days working with SCADA systems. We called it a Recipe but it was something basic and each Recipe was saved as a text file. Any time we wanted to load a recipe to system, it looked for the Recipe file and later send the data to field.

But working later with MES (Manufacturing Execution Systems) these Recipes are called BOM, have a complex structure and have higher value due to need to have a traceability and of course, a real database is used to save and retrieve that data. I never saw the DB’s internal structure of those MES I worked but reading your work, now I can understand the challenge.

But working with Glide and the need to be efficient and save rows, we need to create something better to avoid having a “rows eater” :grinning:

Although a BOM looks like a list and we think we must write its products/items in rows I can bet we can write all this in one row in order to save space. I try to make an analogy between this case and the way we collect products to an order on a Delivery APP and I see almost the same: it’s possible.

Depending of BOM structure, we can put its selected items in a list and later, playing with an array, create (a) multiple relation(s) to retrieve more data from other tables and keep the traceability.

It’s just and quick idea sitting down on my comfort chair watching TV but I think it will work :innocent: :wink:

Greetings!

Feliz fin de semana!

3 Likes