How to use variable to get data from JSON array

You really should have a read through the PMS topic.
This is pretty much the reverse of my hourly sales loops.
That was a 3-4 tier loop structure;
Mine was;
Count tickets
loop tickets into ticket list
loop through tickets
count ticket orders
loop through ticket orders
building the array as it goes.

Yours would be the inverse dissecting the array in to parts in loops

I would say;

Have a triggered script with popup to notify of new orders then initiate the ‘download’
Get array for all new orders to program setting with second program setting to remember array order index to allow doing one order at a time for confirmation.
Do one order, set that index to that second setting, built ticket, confirm ticket and recall that index setting +1 to move to next ticket.

OR

What would be better way I think and how I would try.
Completely automated behind the scenes making the tickets on ‘HOLD’ with notification that there are new tickets.
Opening them takes them off hold and allows confirmation.

The second way could work nicely :wink:

When we automate this

  1. Create ticket
  2. Add order -> need items[i]
  3. Tag Order -> need ordertags[t] for items[i]
  4. Goto 3 to add more tag
  5. Goto 2 to add more
  6. Change Ticket Entity
  7. User confirm or add/edit
  8. Goto 1 to create another

I think we only need 1 data bit at the time.

Ok, see what your looking to do.
That way could be doable I think storing the ‘progress index’ for the order array in program setting.

That is the only way to automate that I can think of.

That mean it already write to database so, Cancel/Add or Remove order tags won’t work.
Many time customer write their own instruction for an item which is still need user intervention.

I see what your saying.
But I would drop all orders into the ticket and edit there.
What might be an idea would be say while creating the orders in the ticket it generates a string of the raw values (not the array but the important values) in a eldigable ticket style layout to go into ticket note or maybe really nice would be to print that so you say;

Open ticket
Click import orders
All order items (ticket orders) are added and a print of the ‘rendered array’ so you can look over the printed order against whats on the ticket, cancel/edit before submitting?

Can you try this please 


r.orders[o].items[i]["id"]
r.orders[o].items[i][myVar]
1 Like

It works! Thank you!

@QMcKay preventing me from launching nuclear bomb. :smile:

1 Like