I’m working on an app where i’m going to build assembles that are made up of different parts.
So I have a data type material (all my parts) and a data type assemblies. In the assemblies data type I have a field for a list of material and a field for a list of quantities (numbers).
*As far as I have found you can’t do arrays in bubble.
That went pretty smoothly. I’m assuming the data is always input into the database in order so using the index value should associate the correct quantity with the correct material.
Now my issue i’m having is I’m trying to display this data in a detail view for the user to review and since there are multiple data types that i’m trying to display in a repeating group I’m not understanding how to correctly display the information.
I’ve attempted to search for the value, but I feel like I’m just searching in circles.
Basically I have two lists and I want the value of both lists at the same index.
I’ve included a few pictures if that helps. I’m going to take a break and maybe it will come to me when I come back, but appreciate any pointers anyone has.
So reading through your post was somewhat helpful.
My main concern with this approach and maybe it shouldn’t be is the potential number of entries this could cause. Because if I understand correctly each different ‘Ingredient’ that is part of a recipe will have to be a completely different entry in the ‘Component’ type.
In my app I’m also going to have ‘Orders’ that will have lists of ‘Assemblies’ with quantities. So I’ll have to do the ‘Component’ data type again.
I understand your point about sorting two different lists might cause issues.
Trying to explore the different options that are available to handle data association.
Just a thought that I’m not even sure is possible. But could you combine the ‘Ingredient’ and ‘Quantity’ into a text (or other type). Then later extract the two later?
Though I don’t know has feasible this is especially since a custom type seems to be saved using the ‘Unique ID’ associated with it. So you would end up with a long text that is just a random list of letters/numbers.
When clicking the ‘ADD’ button I want to add the selected material and quantity to the repeating group. But I’m planning on using a Custom State to add the inputs to and then create the things when the ‘Add Assembly’ button.
I’m wanting to create a custom state of ‘Assembly Line Item’ then when I create the assembly create all the ‘Assembly Line Item’ data types. If that makes sense.
Maybe my problem is I’m thinking about how I would do this with a programming language and not how to do this with Bubble.
So what I’ve done for my example is the following.
I have a ‘Material’ data type, an ‘Assembly Line Item’ data type → this has a list of ‘Material’ ,an ‘Assembly’ data type → this has a list of ‘Assembly Line Item’.
Material: Description (text), Part Number (text), Manufacturer (text), Price (number) Assembly Line Item: Assembly Material (List of Material), Line Item Total (number), Quantity (number), UniqueID (text) Assembly: Name (text), Assembly Material List (List of Assembly Line Item), Assembly Cost (number)
I’m creating my new ‘Assembly’ through a popup. So in my workflow i’m creating a uniqueid to associate with the ‘Assembly Line Items’ since they are being written directly to the database when they are added to the repeating group. Then when I create the assembly I can assign all the ‘Assembly Line Items’ to the ‘Assembly’.
Its not perfect and still working out some kinks. The only issue right now that I see is for part of the workflow I’m writing directly to the database instead of to a state.
Also I am able to do cost calculations pretty easily.
Right now I think this solves my problem. Probably will refine this as I go, but hopefully this helps someone else that may be trying to do the same thing.
I have been toying around with this for awhile and still not making much progress.
A brief summary of what I’m trying to do with my app.
Since in previous posts the recipe/ingredients example was used I’ll follow that logic.
A user can create a list of ‘Material’ → (Ingredients).
Then the user can build an ‘Assembly’ with each ‘Assembly’ having a list of ‘Assembly Line Item’. The ‘Assembly Line Item’ has a ‘Material’ filed and a ‘Quantity’ field.
So the ‘Assembly’ would be a cake. The ‘Assembly Line Item’ list would be (2) flour, (3) eggs, (1) butter, etc.
(The idea is to build ‘Assembly’ that can be used over and over again and/or updated when something needs changed.)
Then the user can create an ‘Order’ that with each ‘Order’ having a list of ‘Order Line Item’. The ‘Order Line Item’ has a ‘Assembly’ field and a ‘Quantity’ field.
I have all of that setup and everything works and is associated how I want.
What I am struggling with is getting a complete list of all the ‘Material’ → Ingredients.
Since multiple ‘Assembly’ can have different quantities of ‘Material’ and each ‘Order’ can have different quantity of ‘Assembly’. I haven’t been able to figure out a way to multiple the numbers together and create one list.
I can create a list of ‘Assembly’ and their quantities associated with each order and a list of ‘Material’ with each order, but NOT the total quantity of ‘Material’.
I need to be able to multiple the ‘Order Line Item’ quantity by each ‘Assembly Line Item’ quantity then add/combine all that into one list. From what I have figured out so far it doesn’t appear you can multiply a list of numbers by a single number.
Just wanted to see if anyone had tried something similar and/or has any suggestions.
Although nesting repeating groups can solve complex issues seemingly like magic, be aware each nested item significantly slows down the page performance (at least in my experience).
This might be OK for seldom-used parts of your site (such as unusual/rarely-used admin functions and views), but generally in production I avoid nesting anything that is being pulled from the database.
Altough I agree with @helpful-pixel that it potentially can slow down your page, it’s important to know about the actions you can take to improve the user experience.
Two of them are:
On page load, load all data into custom states.
Show an progress bar/animation to the user while populating the repeating groups and do the calculation.
It is necessarily not a problem, so test with an amount of dummy data that reflects the amount of production data.
Back to the original challenge:
You might want to explore the option of Schedule a workflow on a list > Schedule a workflow on a list > … to drill down in your data and save the calculations in a data type.