cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How to copy data multiple times

Walkback
New Contributor

I have a requirement, where by I need to copy the same data into all the entries in a JSON array. The data I need to copy is

โ€œcountryIsoโ€ : โ€œGBโ€
โ€œsessionIdโ€ : โ€œed7e8228-a82b-44e0-adea-caee6c61a987โ€

I have an typical JSON array structure:

"orderLine": [
   {
	  "orderLineNumber": "000004",
	  "product": "21909232109737",
	  "productName": "Avon WT7 Snow (Winter Tyre) 195/65 R15 T (91)",
	  "quantity": "48",
	  "unitPrice": "44.34"
   },
   {
	  "orderLineNumber": "000013",
	  "product": "039400014592",
	  "productName": "Goodyear Eagle F1 Asymmetric 5225/40 R18 Y (92)",
	  "quantity": "32",
	  "unitPrice": "38.88"
   },

Then I want to copy countryIso and sessionId to each array entry, like this:

"orderLine": [
   {
	  "orderLineNumber": "000004",
	  "product": "21909232109737",
	  "productName": "Avon WT7 Snow (Winter Tyre) 195/65 R15 T (91)",
	  "quantity": "48",
	  "unitPrice": "44.34",
	  "countryIso" : "GB",
	  "orderId" :  "ed7e8228-a82b-44e0-adea-caee6c61a987"
   },
   {
	  "orderLineNumber": "000013",
	  "product": "039400014592",
	  "productName": "Goodyear Eagle F1 Asymmetric 5225/40 R18 Y (92)",
	  "quantity": "32",
	  "unitPrice": "11.88"
	  "countryIso" : "GB",
	  "orderId" :  "ed7e8228-a82b-44e0-adea-caee6c61a987"
   },

I have used extend to add the fields, but try as I might I just canโ€™t copy the data to each entry, has anybody done anything similar?

Regards

Jay

5 REPLIES 5

Walkback
New Contributor

Thank you for your support and suggestions. I solved this problem, using a stored procedure.