Order Management System

Hi All!

I am trying to create an order management system for my Shopify store. I previously posted in the forum with a question of how to combine some information that the Shopify pack brought into my doc. The problem was successfully solved, however, I then realized that the pack wasn’t bringing in all my orders. There is a size limit to the orders that coda will bring in. A lot of my orders are in the 50-100 item range with some being larger than that. These large orders are the hardest to manage and the most important so the fact that they couldn’t be brought into coda using the Shopify pack was a bummer.

I have found a workaround to getting the data in. You can create a Zap that pulls in new orders. This doesn’t have a size limit and all my orders get pulled in. However the data is formatted differently and the formula I used to combine data with the Shopify pack no longer works and I cannot figure out a solution.

I am trying to combine 3 columns. Vendor, Item and, quantity. The data in each column is a list of values separated by commas. When the data is combined I need the first item in each list to be paired together then havea comma then the second item in each list combined then a comma. The shopify pack formula that worked is:

thisRow.Order.LineItems.FormulaMap(Concatenate(CurrentValue.Vendor," “,CurrentValue.Name,” x",CurrentValue.Quantity))

Here is the link to my first topic that solved my initial problem.

The Formula that I am using on the data pulled from shopify using the Zap is:

thisRow.FormulaMap(Concatenate(thisRow.Vendor," “, thisRow.Item,” x",thisRow.Quantity))

This is just putting one list in front of the next instead of pairing up the values.

The doc is here:

Any help is appreciated.

Best!
Canon

Hi @Canon_Huse,

I provided an additional column to your table with the formula.
Let me know if this is the outcome expected.

A quick explanation:

Sequence(1, thisRow.Vendor.Length(),1).  // Since you have to combine "parallel" lists, you need to have a reference of the item you are processing: Sequence() holds the iteration index
    FormulaMap(  // for each value of the index (stored in CurrentValue)
        Format("{1} {2} x{3}",   // format three values
            thisRow.Vendor.Split(",").Nth(CurrentValue),  // Vendor
            thisRow.Item.Split(",").Nth(CurrentValue),  // Item
            thisRow.Quantity.Split(",").Nth(CurrentValue)  // Quantity
        ).BulletedList() // just to read it easier (you can remove it)
    ).Filter(CurrentValue.IsNotBlank()  // Remove empty entries created by the Split()s. Note: in this context CurrentValue is the Item processed by FormulaMap(), not the Sequence()'s index.
) 

Let me know if this helps.

I’m also thinking if this is the easiest way to design the data model in order to extrapolate these information…

P.S.
the column Example of what is wanted is simply great: it’s the best way to let people understand in the simplest yet most efficient way! :slight_smile:

3 Likes

@Federico_Stefanato Wow! That was a super helpful explanation. I really liked the commentary on what each part of the formula was doing and why it was included. This solution works for what I need.

What do you think could be the easiest way to design the data model?

@Federico_Stefanato your post made me go to the formula editor and see if //comments had stealth launched. Disappointment to start the day!! hahah :slight_smile:

1 Like

Ahahah!
@Johg_Ananda, sorry for creating this delusion.

Totally agree with you!
I miss code comments (and overall formatting) like water…

Although I guess it’s not Coda’s very first priority.

Let’s say we’ll celebrate together when they -finally - will introduce them :beers::wink:

2 Likes

Just wanted to jump in to thank you for the Sequence + FormulaMap comb that I discovered with this post.
I used it intensively to recode the Workday formulas so that it could include partial days. It was a tough fight, there’s blood everywhere, but I took it down finally :slight_smile:

1 Like

Hi @Laurent_Auneau,
happy that it helped and that eventually… everyone is safe (despite the blood)! :upside_down_face: