I am new in bubble and I don’t have any experience in coding. So, some of my questions might not make any sense.
I am trying to build CRM kind of tool for my business. I need help to record my order data. My orders usually have multiple colors. Sometimes can be one color but sometimes up to 10 colors. I built an example form below. Besides color and color quantity, all other data will be the same for them. Instead of entering them one by one as separate orders, I want to record them at once as multiple records. Because in my orders repeating group, I want to show all colors in one cell. I hope I explained it clearly. Thanks in advance.
I think the approach that would work for you here is the have an order object that contains the information in the left column, and then another object order items that would be used for the colors in the right object. In your database, you would have the following:
Order:
Style Number
PO Number
Customer
Supplier
Price
Shipment Date
Total Quantity
List of Order Items
Order Item:
Order
Color
Quantity
To make this happen, just create the order object when you load the form you show above, when you click add color, create a new order item, and then when you click save, update the order and the order items with the input values. Then to show them in a repeating group, have a repeating group with the order and then another repeating group inside of the order cell that displaces the List of Order Items.
Thank you for the answer. If I understood correctly, I am going to create 2 types of data. Order and Order Item. When I click on save button, I will save them in 2 separate data charts. In Order Item I will save the same order number. In my case, it will be my PO number. Or should I save Order’s unique id?
Yes, you are creating two data types. On the order item, when you create the Order field, the type of field will be Order. Essentially, you are creating a relationship between the two tables in the database. On the order type in the database, create a field card List of Order Items and the field type is the order item.
In your workflow, when you navigate to the form that you posted earlier, I would recommend creating the order as part of the navigation workflow. Then on the form, have a repeating group to show the order items (color) that have been created and place two inputs, one for the color and one for the quantity, and when those are filled out, the user clicks add and it creates the order item and adds it to the order’s list of order items.
The last step in the process would be when you click the save button. You would update the order with all the values in the inputs. The relationship you create between the two items will ensure that you can pull everything together when you want to display it.
I set it up as much as I can and I think it worked but somehow when I click on save, it’s not updating the values and in both data charts inputs are coming empty. I will try again from the beginning and see. Thank you for the idea.
@jdiaz I have been trying for hours but I couldn’t figure it out. Now its saving the order item data but order is coming empty. Also, repeating group is not showing the colors. And after I click on save, it is not saving the order data. I would be appreciated if you can take a look at it whenever you have time.
Okay, looking over this, there are a couple of things that you need to do. First, in your database on the order object, you have the order items, but you need to make it a list field. When you create a new field, make sure that the checkbox “this is a list (multiple entries)” is clicked.
On page load you are creating the order, but you don’t need to put the PO number in the field. You can put the number in the input and then update it when you save it. One thing that you do need to do is add a group and place all the order inputs into that new group. The new group should have a type of order and you can leave the data source blank. Then in your on page load workflow, add another action after the order creation, but this one is display data under the element actions section. The element is the group you just put all the inputs into and the order is the result of step 1.
For the workflow to add a new color, add another action after the creation. The action should be data - make changes to a thing. The thing you are making changes to is the order, and the field is the list of order items. You want to add the result of step 1.
Last, when you go to save the order, the order you are updating in the workflow is the current page order. You do not need to do a search for it, just select Current Page Order. You also don’t need to do anything with the list of order items if you already make the changes I listed in the previous paragraph.
If you do what I outlined above, I think that will get you most of the way there. Let me know if you have any questions or need me to clarify anything.
I set it up as you explained but there are 2 problems.
When I click on save, it is creating both order and order items. (In order data List of Order Items is coming empty. I am not sure will that be a problem when I try to match them later on.)
And when I go back to index page and try to create another order, it is deleting the data of first order. List of Order Items becoming like this.
@ozancanan - on the workflow for creating the order item, you need to add a second action. Add Make Changes to a Thing from under the data tab. You want to make changes to the current page order and then the field to change is List of Order Items. You want to ADD result of step one. This will add the order item to the list on the order and then populate the second repeating group. You actually had this action built, I moved it to the add button workflow.
As for the second item, when you navigate from the index page to the order creation page, you are sending an already created order to the add new order page and then on page load it creates another order. That order is then displayed in the group with all the inputs, but the repeating group is referencing the order sent in the go to page action. To fix this, on the index page, when you click add new order, create the new order first and then navigate to the new page and send the created order. Then on the add new order page, change the order group containing all the inputs to current page order and everything should work. I made the changes, so it should work now.