Hello Everyone
We are using a SQL Active Link table to read orders being created in a web ecommerce platform. The data is stored in MySQL, and the structures is very flat.
ONE ORDER = ONE ROW
Essentially they have merged the typical ORDER HEADER table and ORDER DETAIL table into one ORDER table.
The storage of the detail data including ITEM, QTY, PRICE, DESC, etc is contained in one MEMO field.
We need to write a script that reads the memo field data into a variable, parses the data in the variable, and creates a new ORDER DETAIL row with each new product ordered.
The Json legend of formatting is at http://www.json.org/
the Array is shown via [ ]
The Object is shown via { }
The data example below should create 3 separate records
[{"rowid":"3a3d205e3f77d0d10822a2a7e7acf83e","id":"5","qty":1,"price":"35.95","name":"Magic Panty","options":{"color":"Bianco","size":"ML","sku":"8300496004851"},"subtotal":"35.95"},{"rowid":"321578152208d3d15681a497403ed26c","id":"5","qty":1,"price":"35.95","name":"Magic Panty","options":{"color":"Noisette (Hazelnut)","size":"M","sku":"8300496004943"},"subtotal":"35.95"},{"rowid":"c0ab5b5101bbb85339ce1a73f0e7dcb5","id":"5","qty":1,"price":"35.95","name":"Magic Panty","options":{"color":"Nero (Black)","size":"M","sku":"8300496005117"},"subtotal":"35.95"}]
We are using a SQL Active Link table to read orders being created in a web ecommerce platform. The data is stored in MySQL, and the structures is very flat.
ONE ORDER = ONE ROW
Essentially they have merged the typical ORDER HEADER table and ORDER DETAIL table into one ORDER table.
The storage of the detail data including ITEM, QTY, PRICE, DESC, etc is contained in one MEMO field.
We need to write a script that reads the memo field data into a variable, parses the data in the variable, and creates a new ORDER DETAIL row with each new product ordered.
The Json legend of formatting is at http://www.json.org/
the Array is shown via [ ]
The Object is shown via { }
The data example below should create 3 separate records
[{"rowid":"3a3d205e3f77d0d10822a2a7e7acf83e","id":"5","qty":1,"price":"35.95","name":"Magic Panty","options":{"color":"Bianco","size":"ML","sku":"8300496004851"},"subtotal":"35.95"},{"rowid":"321578152208d3d15681a497403ed26c","id":"5","qty":1,"price":"35.95","name":"Magic Panty","options":{"color":"Noisette (Hazelnut)","size":"M","sku":"8300496004943"},"subtotal":"35.95"},{"rowid":"c0ab5b5101bbb85339ce1a73f0e7dcb5","id":"5","qty":1,"price":"35.95","name":"Magic Panty","options":{"color":"Nero (Black)","size":"M","sku":"8300496005117"},"subtotal":"35.95"}]
Comment