Hi
I am looking for some best practices for data prep especially while mapping XDM data from one field to another field.
If anyone have any interesting use cases please share.
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
I don't know about "best practices" as I'm still muddling through figuring it out myself. If you're simply mapping one XDM field to another, then it is pretty straightforward. Things get trickier once you start using calculated fields. Some tips:
I will say, at least in my own experience, I've found that leaving things UNescaped works best, despite what documentation says.
Adding a full JSON object each time you open data prep is a pain, but it is necessary if you want to preview how your calculated fields are working.
Your question was pretty open-ended so I'll just show some calculated fields I set up in the past, though whether or not they were the BEST way to do a thing is up for debate. These were all clearly for an AEP-to-Analytics implementation, so sorry for the lack of variety :
(I'm not proud we had to do a lot of these transformations- in a happier world, we'd have gone back to the devs and had them fix things. "Correcting" data in data prep should be a last resort, IMO).
*A lot of them have asterisks because I'm still wondering if I regret doing it this way. The problem with the approach I took is that I told all those iif statements to either return "1" or ""... but unfortunately, returning "" throws "source field was null" errors in Assurance. If you have it return "0" instead, then when you look at your analytics event field it will have something like "event1=0,event2=0,event3=0" etc, for every event you've given a "0" to. With 20+ events it gets really ugly. So if I did it again, I'd need to choose between the harmless but annoying AEP "source field was null" errors, or a big long ugly events string. Neither is ideal (I'm open to suggestions if there is a better way).
@Pradeep_Kumar_Srivastav@Jennifer_Kunz@narendragandhi@shuaib27811@Abishek_mathav12345678@user48
Kindly take a moment to review this question and share your valuable insights. Your expertise would be greatly appreciated!
Views
Replies
Total Likes
Hello @Ankit_Chaudhary
It depends on the data which is in the source to the target.
I refer back to the data prep functions and determine which is best when mapping source to target with the data prep functions.
https://experienceleague.adobe.com/en/docs/experience-platform/data-prep/functions
I don't know about "best practices" as I'm still muddling through figuring it out myself. If you're simply mapping one XDM field to another, then it is pretty straightforward. Things get trickier once you start using calculated fields. Some tips:
I will say, at least in my own experience, I've found that leaving things UNescaped works best, despite what documentation says.
Adding a full JSON object each time you open data prep is a pain, but it is necessary if you want to preview how your calculated fields are working.
Your question was pretty open-ended so I'll just show some calculated fields I set up in the past, though whether or not they were the BEST way to do a thing is up for debate. These were all clearly for an AEP-to-Analytics implementation, so sorry for the lack of variety :
(I'm not proud we had to do a lot of these transformations- in a happier world, we'd have gone back to the devs and had them fix things. "Correcting" data in data prep should be a last resort, IMO).
*A lot of them have asterisks because I'm still wondering if I regret doing it this way. The problem with the approach I took is that I told all those iif statements to either return "1" or ""... but unfortunately, returning "" throws "source field was null" errors in Assurance. If you have it return "0" instead, then when you look at your analytics event field it will have something like "event1=0,event2=0,event3=0" etc, for every event you've given a "0" to. With 20+ events it gets really ugly. So if I did it again, I'd need to choose between the harmless but annoying AEP "source field was null" errors, or a big long ugly events string. Neither is ideal (I'm open to suggestions if there is a better way).
If I need to extract a string from the string version of a set of key value pairs, how can I do it?
Example -
"{\"userContextDoubleValue\":32624.62,\"valueNumber\":30311.48,\"ucStringValue\":\"Sample value\",\"fieldName\":\"Sample value\",\"userContextIntegerValue\":5521,\"userContextDateValue\":\"2018-01-12\",\"valueDate\":\"2018-11-12T20:20:39+00:00\",\"valueString\":\"Sample value\",\"ucDateValue\":\"2018-11-12T20:20:39+00:00\",\"ucDoubleValue\":32225.57,\"valueDouble\":18612.33,\"ucIntegerValue\":28996,\"codesArrBeta\":[17302],\"userContextStringValue\":\"Sample value\"}"
If I need to extract the string "Sample value" (corresponding to valueString), only if the "fieldName" is "Sample value"?
The output should be "Sample value".
"{\"userContextDoubleValue\":32624.62,\"valueNumber\":30311.48,\"ucStringValue\":\"Sample value\",\"fieldName\":\"Sample value2\",\"userContextIntegerValue\":5521,\"userContextDateValue\":\"2018-01-12\",\"valueDate\":\"2018-11-12T20:20:39+00:00\",\"valueString\":\"Sample value\",\"ucDateValue\":\"2018-11-12T20:20:39+00:00\",\"ucDoubleValue\":32225.57,\"valueDouble\":18612.33,\"ucIntegerValue\":28996,\"codesArrBeta\":[17302],\"userContextStringValue\":\"Sample value\"}"
for the above string, I should get no output, also if I have more than one fieldName in the string, I should still be able to extract only for "Sample value".
"{\"userContextDoubleValue\":32624.62,\"valueNumber\":30311.48,\"ucStringValue\":\"Sample value\",\"fieldName\":\"Sample value2\",\"userContextIntegerValue\":5521,\"userContextDateValue\":\"2018-01-12\",\"valueDate\":\"2018-11-12T20:20:39+00:00\",\"valueString\":\"Sample value\",\"ucDateValue\":\"2018-11-12T20:20:39+00:00\",\"ucDoubleValue\":32225.57,\"valueDouble\":18612.33,\"ucIntegerValue\":28996,\"codesArrBeta\":[17302],\"userContextStringValue\":\"Sample value\"};{\"userContextDoubleValue\":32624.62,\"valueNumber\":30311.48,\"ucStringValue\":\"Sample value\",\"fieldName\":\"Sample value2\",\"userContextIntegerValue\":5521,\"userContextDateValue\":\"2018-01-12\",\"valueDate\":\"2018-11-12T20:20:39+00:00\",\"valueString\":\"xyz\",\"ucDateValue\":\"2018-11-12T20:20:39+00:00\",\"ucDoubleValue\":32225.57,\"valueDouble\":18612.33,\"ucIntegerValue\":28996,\"codesArrBeta\":[17302],\"userContextStringValue\":\"Sample value\"}"
should return "Sample value"
Views
Replies
Total Likes