Expand my Community achievements bar.

Join us on September 25th for a must-attend webinar featuring Adobe Experience Maker winner Anish Raul. Discover how leading enterprises are adopting AI into their workflows securely, responsibly, and at scale.
SOLVED

Mapping within Data Prep Tool for productListItems.quantity not working as expected

Avatar

Level 2

Hi all,

I've run into issues with mapping inside the data prep tool, specifically within productListItems. The solution would need to be able to iterate through an array.

I am experiencing a dataset error where the Quantity is coming back as a string and not a number. I updated the code in my launch script so it would stop happening but am still getting this error about once a day. I tried using the following code within Data Prep Tool using a calculated field but it is still not working. My target field would productListItems[*].quantity but I cannot use that notation inside a calculated field because it does not accept [*].

Mapping Tried

  • to_integer(quantity). 
  • to_integer(productListItems.quantity)

Error message in datasets: #/productListItems/0/quantity: expected type: Number, found: String.

Sample Array:
[
{
"sku": "HGYU_89",
"name": "Wireless Mouse",
"pricetotal": 29.99,
"quantity": 2
},
{
"sku": "ABC_01",
"name": "Mechanical Keyboard",
"pricetotal": 89.95,
"quantity": 1
},
{
"sku": "XYZ_02",
"name": "USB-C Hub",
"pricetotal": 45.50,
"quantity": 3
}
]

Any assistance would be greatly appreciated!

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @BReyes17 ,

In my opinion the best way to transform array fields is either on client side where developers can help you pass the right format or in Adobe Launch which seems you have already done. Data prep cannot transform the array fields as you cannot use them in calculated fields.

I think what you have built in Adobe Launch should be enough, 1-2 instances that you still see might be coming from old cached libraries on some user browsers which should clear out with time.

Cheers!

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hi @BReyes17 ,

In my opinion the best way to transform array fields is either on client side where developers can help you pass the right format or in Adobe Launch which seems you have already done. Data prep cannot transform the array fields as you cannot use them in calculated fields.

I think what you have built in Adobe Launch should be enough, 1-2 instances that you still see might be coming from old cached libraries on some user browsers which should clear out with time.

Cheers!