Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Generate rows in code

Feras95p
8 - Asteroid

Dear all,

 

I have input file like the sample attached which each row have "barcode", "price" and "ID" what I want is to design a workflow that take this input and generate for each row a code like below one:- Note that the bold one must be repeated inside the code like in the sample file I have 75 rows so the bold one in the code will be repeated 75 times and in each time will take the data of the barcode, price and quantity from each row.

 

{
    "skin""weborder",
    "establishmentId"1,
    "items": [
        {
            "barcode": "****",
            "price": **,
            "quantity": **
        },
    ],
    "orderInfo": {
        "dining_option"109,
        "asap"true,
        "customer": {
            "phone""0000011112",
            "first_name""**",
            "last_name""Auto-poster",
            "email""**"
        },
        "call_name""Paid-Orders",
        "call_number"909080
    },
    "paymentInfo": {
        "amount""0.00",
        "type"7,
        "transaction_id""909080"
    },
    "discounts": [
        {
            "barcode""MMD22",
            "amount"**
        }
    ]
}
3 REPLIES 3
Luke_C
17 - Castor
17 - Castor

Hi @Feras95p 

 

It looks like you want to create JSON. You can use the JSON Build tool for this. See below example. I didn't layer in the order info/payment info/discounts fields, but hopefully you can use this as a starting point.

Luke_C_1-1648654919404.png

 

 

Luke_C_0-1648657112969.png

 

 

Feras95p
8 - Asteroid

Hi @Luke_C , 

 

Many thanks for helping ! How can I layer the other information as well after the items information? I tried but I couldn't have the correct output

Luke_C
17 - Castor
17 - Castor

hi @Feras95p 

 

Try something like this, assuming the other fields are static. The best way to learn how to produce JSON using alteryx is to take some already working JSON and review the results from a JSON parse tool. If you can get your data to look like the JSON parse tool output, you can use the JSON build tool to get it back into JSON format.

Luke_C_1-1648681154128.png

 

 

Luke_C_0-1648681135084.png

 

Labels
Top Solution Authors