Append values to array in profiles attributes using mapping functions
Hi. I am having a problem with arrays in profile attributes and need guidance.
I am performing a proof of concept of arrays on profile attributes applying mapping functions. I have an XDM Individual Profile schema that, among its fields, there is an array of strings. In the same way, I have a dataset based on that schema.
I am using the Local File Upload source to upload CSV files. I have the following CSV files:
test1.csv
ID_CLIENTE_CORE, ARRAY
T0000000001, Hellotest2.csv
ID_CLIENTE_CORE, ARRAY
T0000000001, FriendWhen it comes to mapping, I create a calculated field as follows:
upsert_array_append(to_array(false, ARRAY))Let me explain why I use these mapping functions:
- to_array(value): This function converts a string, for example 'Hello', into an array. This causes 'Hello' to become ['Hello']. [1]
- upsert_array_append(value): This function, in theory and following the Data Prep documentation, adds all elements of the full input array to the end of the array in Profile. This generates, in theory, that if a profile has an array in the path _tenant.arrayTest.array as profile attribute, with value of ['Friend'], and value is equal to ['Hello'], subsequent to loading the CSV file, the value of the profile attribute is ['Friend','Hello',]. Please correct me if I am wrong. [1]
I have tried the following mappings:
| Source data | Target fields |
| upsert_array_append(to_array(false, ARRAY)) | _tenant.ArrayAppendTest.array |
| upsert_array_append(to_array(false, ARRAY)) | _tenant.ArrayAppendTest.array[*] |
However, every time I upload data using any of the above mappings, the to_array(ARRAY) field replaces the one that was previously in the profile.
It should be noted that I have the isUpsert flag enabled [2], so I think my problem is related to how I am doing the mapping.
Doc. reference.