Hi,
I need some help on how to update a custom field group I created, which expects an array of strings. I don't see any examples, so I hope it is straight forward. The path is "_drh.menuArr" and I want to be able to populate it with anywhere from 1 - 6 values via a data element. Is populating it as easy as having the data element just return the entire array to the field group or do I have to loop through the values and return each value individually? If I have to return each value individually, how does this work? I'm not sure if I have to specify the index for each value or will the schema auto index the returned values? For example, Let's say my data element wants to return these values:
// Example of data element named "arrayOfMenuItems" which wants to populate "_drh.menuArr"
var dataElementMenuItems = ["up", "down", "left"];
How would I populate the "_drh.menuArr" field group via the data element?
Thanks!
Topics help categorize Community content and increase your ability to discover relevant content.
Can you expand a little bit more on how you're hoping to get it from the data element to that dataset?
Views
Replies
Total Likes
Hi,
In the Data Collection rule where I'm doing an update variable action, within the variable editor where I can specify a data element for the value.
@Harveer_SinghGi1's response will get you exactly what you're looking for! You can use that field in the Audiences view to build audiences, count attiriutes and any other personalization you want to do.
You can also view and analyze those metrics more in depth in CJA. This should get you exactly what you're looking for!
Thank you Tyler! So CJA Workspace will look at the different instances of every value passed in that array? I'd assume so but just want to make sure.
Take care!
Yes exactly!! You can make write additional logic to break out the array, or count the items in the array, so on and so forth in the dimensions & filters within CJA. Once you've got it loaded into AEP, the options are endless!
Hi @MichaelJo13 ,
I assume it is a XDM field that you created (and not a field group) which show data type as string[] next to it's name in the schema view.
If that is the case then it should be pretty straight forward as below,
//settings data element named "Menu Items"
var dataElementMenuItems = ["up", "down", "left"];
return dataElementMenuItems ;
//xdm data element mapping
_drh.menuArr = %Menu Items%
Cheers!
Hi Harveer,
You are correct. So, I just return the whole array. Do you know how CJA reports on the individual items passed? What I want is to have the instances of each item in a report. The values populating the array come from a multi-select combo box.
Thanks!
Hi @MichaelJo13 ,
CJA treats String Arrays similar to how Adobe Analytics works with List Variables. The values passed in a String Array are reported as individual values. So for an example a single hit where you recorded _drh.menuArr field in XDM as ["up", "down", "left"] and let's says passed two metric fields also in the same hit; Metric 1 and Metric 2 will show as below when you run the CJA report for these fields,
_drh.menuArr | Metric1 | Metric2 |
up | 1 | 1 |
down | 1 | 1 |
left | 1 | 1 |
All the values in String array will be shown as individual row items each taking full credit for the metrics recorded on that hit.
Cheers!
Thank you for the explanation! Much appreciated! So position (index) in the array doesn't matter. If "up" is in index 0 in one instance and in index 2 in the next call, CJA will just count two instances of "up"?
Correct! The order of values you see in report will be based on the metric count aggregated across all calls.
Cheers!