Create dynamic variables

Hi,

I am trying to develop an order fulfillment application and require guidance on managing order data dynamically. My data is stored in Airtable, where each order includes multiple associated order lines. Each line captures specific details such as the SKU and quantity of ordered items.

I can call any Order and display the associated lines without any issue.

My challenge lies in dynamically creating variables for each order line in weweb, as the number of order lines can vary. For instance, an order might have three lines (3 ordered items), necessitating the following variables:

Line1_sku = “example_sku_1”
Line1_qty = 10

Line2_sku = “example_sku_2”
Line2_qty = 5

Line3_sku = “example_sku_3”
Line3_qty = 20

The operator will then need to scan X times (X being the qty of each ordered item) each items in order to complete the order.

However, I currently lack a method to create and manage these variables based on the varying number of lines per order.

Could you please provide guidance or examples on how to achieve this functionality in a scalable and efficient manner?

Thank you for your support.

That’s a great question! Let me talk to the team for more details and get back to you as soon as possible.

Because you’ll have a collection of items the first thing is to create an empty array variable.

Second is when fetching the items from airtable you’ll want to grab the array of line items and update the empty array variable.

Next you’ll place that now full array into your element via a bindable property named items.

Then bind from there each object item.

1 Like

hope this helps.

2 Likes

Thanks for sharing!