Hi Team,
We have a requirement to ingest data into a map attribute.
Schema have a map attribute field and values will be ingested using Source database dataflows.
I have to use data prep function 'to_object' to ingest data.
While trying out with the sample code provided in document, it is not inserting any values into map field.
Eg: to_object(“firstName”, “John”, “lastName”, “Doe”) is not ingesting any values.
But, when I used to_object("Test Data",iif(lower(license)=='y',to_object('val','y'),to_object('val','n'))) in ingestion using dataflow, it was showing below result.
Result: [Test Data -> "(NULL,NULL,NULL,y)"]
If I'm referring to documentation, result should be {"Test Data" : {"val":"y"} }
Question: Why the result is not showing up for example provided in documentation.
Is there any way that we can validate why to_object(“firstName”, “John”, “lastName”, “Doe”) is not ingesting any values?
Also, if to_object is not the function that can be used for data prep, which function can be used?
I've referred document https://experienceleague.adobe.com/docs/experience-platform/data-prep/functions.html%3Flang%3Dsv#obj...
@derekselby , @arpan-garg , please share your thoughts
Solved! Go to Solution.
Hi @_abs9900
Map objects are object of array element so can you try ingesting in this way and see if it works -->
to_object("Test Data",iif(lower(license)=="y",to_array(true,to_object("val","y")),to_array(true,to_object("val","n"))))
Hi @_abs9900
can you please share the schema structure where you want to ingest?
Also if you don't use if-else logic and hardcode the value for testing are you able to preview the result?
Hi @arijitg ,
Thanks for your response.
Currently I'm ingesting data into 'Consent and Preference Details' field group oob attribute - consents.marketing.email.subscriptions
When I try with hard coded values provided in documentation to_object("firstName", "John", "lastName", "Doe"), I can preview the result, but data not getting ingested against attribute when the flow runs.
I've validated data in dataset using query service with below command
SELECT
consents.marketing.email.subscriptions
from
<datasetname>
ORDER BY
consents.marketing.email.time ASC;
Snapshot of preview screen:
Hi @_abs9900
Map objects are object of array element so can you try ingesting in this way and see if it works -->
to_object("Test Data",iif(lower(license)=="y",to_array(true,to_object("val","y")),to_array(true,to_object("val","n"))))
@_abs9900 Did you find the suggested solutions helpful? It would be great if you can mark the answer as correct for posterity. If you have found out solution yourself, share it with wider audience in the community.
Views
Replies
Total Likes
Views
Likes
Replies