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

data prep function upsert_array_replace is not replacing array, but appending to array

Avatar

Level 2

Hi Community,

I have to replace complete array with new values of array on every batch ingestion, but on every batch ingestion new items gets appended to this array in target dataset instead of replace. I have used upsert_array_replace in a calculated field and my dataset is profile and upsert enabled. Below is the structure of my target and source array, it has a primary identifier as "key" and "comm_details" array object to  replace. 

Calculate Field : upsert_array_replace (_tenant.comm_details)    -- Source 

Dataset Field   :                                  _tenant.comm_detail[*]       -- Target

I have already gone through documentation.

 https://experienceleaguecommunities.adobe.com/t5/adobe-experience-platform/overwriting-the-array-obj...

https://experienceleague.adobe.com/sv/docs/experience-platform/data-prep/functions#arrays

Could you please let me know if this is expected behavior or I am missing anything.

[
{
    "_tenant": {
      "key": 111111,
      "comm_details": [
        {
          "pol_id": "0018801",
          "email_address1": "sat@SBI.com",
          "email_address2": null,
          "telephone1": "033-333-5533 2211",
          "pol_status": "Active",
          "timeStamp": "2025-07-20T05:49:20Z"
        }
      ]
    }
},
{
  "_tenant": {
    "key": 222222,
    "comm_details": [
      {
        "pol_id": "0018802",
        "email_address1": "adi@SBI.com",
        "email_address2": null,
        "telephone1": "033-333-6633 3322",
        "pol_status": "Active",
        "timeStamp": "2025-07-20T05:49:20Z"
      }
    ]
  }
}
]
 
Thanks in advance !!
1 Accepted Solution

Avatar

Correct answer by
Level 2

Hi Communicty,

upsert_array_replace() works for streaming ingestions only, not for batch ingestion. I am using batch ingestion.

Regards

Santosh

 

View solution in original post

4 Replies

Avatar

Level 5

The upsert_array_replace() function in AEP only replaces arrays if the schema is correctly aligned and the merge policy is configured to support full array replacement. If not, arrays may get appended instead.

To fix this, ensure the source and target schemas match exactly, use a merge policy that replaces (not merges) arrays based on timestamps, and always send the full array in each batch. If the issue persists, contact Adobe Support with payload samples and your merge policy details.

Avatar

Level 2

Hi RishiKumar,

Thanks for the reply.

Merge polices is default i.e. timestamp based, and source and target schema are aligned. I will raise ticket to Adobe.

Regards,

Santosh

Avatar

Correct answer by
Level 2

Hi Communicty,

upsert_array_replace() works for streaming ingestions only, not for batch ingestion. I am using batch ingestion.

Regards

Santosh

 

Avatar

Administrator

Thanks @SantoshRa5, for sharing the update!



Sukrity Wadhwa