upsert_array_replace - target array selection | Community
Skip to main content
February 10, 2025
Question

upsert_array_replace - target array selection

  • February 10, 2025
  • 4 replies
  • 941 views

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!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

4 replies

nnakirikanti
Community Advisor
Community Advisor
February 10, 2025

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

 

~cheers,

NN.

VijayBa5Author
February 10, 2025

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. 

nnakirikanti
Community Advisor
Community Advisor
February 10, 2025

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

 

~cheers,

NN.

RiteshY18
Community Advisor
Community Advisor
February 13, 2025

@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.

kautuk_sahni
Community Manager
Community Manager
February 17, 2025

@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