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.

upsert_array_replace - target array selection

Avatar

Level 1

I am using the upsert_array_replace function in Data Prep mapping. I have correctly selected the source array in the calculated fields and want to replace a specific array in the target. However, the target contains multiple arrays, each identified by an array_id attribute.Is there a way to filter or match the array_id between the source and target arrays to identify the correct target array? how can I determine its position in the target array for replacement? Any guidance or examples would be greatly appreciated!

6 Replies

Avatar

Community Advisor

@VijayBa5 Can you please provide the Schema structure and data prep mapping you are trying to do?

 

~cheers,

NN.

Avatar

Level 1

my schema is simple: a list of arrays using array of objects. 

 

example:

hotels: (array of objects)

{hotel_id:001, hotel_sqft:10000}, 

{hotel_id:002, hotel_sqft:20000},

and have 10's. of them for a single profile

 

source mapping: upsert_array_replace([hotel_id:002, hotel_sqft:25000]) //this is fine

target mapping:hotels[] //how do i pick the right array position / index so it can be replaced. 

Avatar

Community Advisor

@VijayBa5 how are you injecting the data? streaming upsert(merge mode) or any another way? 

 

~cheers,

NN.

Avatar

Level 1

thanks for your quick response @nnakirikanti 

 

yeah, we are doing both streaming and batch. For streaming we are using data operation: merge

Avatar

Community Advisor

@VijayBa5  i would suggest as best practice not use an array more than one level down but rather simply your schema/ data mode using class and relationship as much as possible, as in long run multiple array levels would have an impact.

Avatar

Administrator

@VijayBa5 Did you find the suggestions helpful? Please let us know if you need more information. If a response worked, kindly mark it as correct for posterity; alternatively, if you found a solution yourself, we’d appreciate it if you could share it with the community. Thank you!



Kautuk Sahni