Thank you for your reply!
@bjoern__koth wrote:
I saw you asked exactly the same question here, without answer yet. Can you give a quick update on what you have tried so far?
That was someone else's question that I commented on. @jinx0011's question was similar, but it was not exactly the same question. The main reason I asked this question separate from @jinx0011's question is because I did not want to presume the solution required the "Ability to use array notation ([*]) in calculated field". I also wanted to provide a set of input and output JSON examples so if people wanted they could paste the JSON into Data Mapping to define the incoming data and test/validate potential solutions.
Here's everything I that I tried (among calculated fields that Data Mapping allowed me to save without throwing an error), and their results:
============= First attempt =============
- add_to_array(to_array(true,""), concat(data.eventInfo.component.type, "=", data.eventInfo.component.name)) -> _experience.analytics.customDimensions.lists.list2.list[*].value
=== Result (from analytics.hit in AEP Assurance session) ===
mvvar2: [Ljava.lang.Object;@7f24998d|[Ljava.lang.Object;@27082dd5=[Ljava.lang.Object;@5458d032
============= Next attempt =============
- to_array(true, concat(data.page.facetRefinement.name, "=", data.page.facetRefinement.value)) -> _experience.analytics.customDimensions.lists.list1.list.value
- add_to_array(to_array(true,""), concat(data.eventInfo.component.type, "=", data.eventInfo.component.name)) -> _experience.analytics.customDimensions.lists.list2.list.value
=== Result (from analytics.hit in AEP Assurance session) ===
mvvar1: [Ljava.lang.Object;@50fc0814
mvvar2: [Ljava.lang.Object;@e0fa70e
============= Next attempt =============
- to_array(true, concat(data.page.facetRefinement.name, "=", data.page.facetRefinement.value)) -> _experience.analytics.customDimensions.lists.list1.list[*].value
- add_to_array(to_array(true,""), concat(data.eventInfo.component.type, "=", data.eventInfo.component.name)) -> _experience.analytics.customDimensions.lists.list2.list[*].value
=== Result (from analytics.hit in AEP Assurance session) ===
mvvar1: [Ljava.lang.Object;@5239757d=[Ljava.lang.Object;@269e0fc1
mvvar2: |[Ljava.lang.Object;@6025240f=[Ljava.lang.Object;@71bd3c1b
============= Next attempt =============
- to_array(true, to_object("value", concat(data.page.facetRefinement.name, "=", data.page.facetRefinement.value))) -> _experience.analytics.customDimensions.lists.list1.list[*]
- add_to_array(to_array(true,to_object("","")), to_object("value", concat(data.eventInfo.component.type, "=", data.eventInfo.component.name))) -> _experience.analytics.customDimensions.lists.list2.list[*]
=== Result (from analytics.hit in AEP Assurance session) ===
mvvar1: [Ljava.lang.Object;@13d8bcfc=[Ljava.lang.Object;@4ecf0391
mvvar2: [Ljava.lang.Object;@72fc2d9c=[Ljava.lang.Object;@76fc9f7a
============= Next attempt =============
- to_array(true, to_object("value", concat(data.page.facetRefinement.name, "=", data.page.facetRefinement.value))) -> _experience.analytics.customDimensions.lists.list1.list
- add_to_array(to_array(true,to_object("","")), to_object("value", concat(data.eventInfo.component.type, "=", data.eventInfo.component.name))) -> _experience.analytics.customDimensions.lists.list2.list
=== Result (from analytics.hit in AEP Assurance session) ===
mvvar1: [Ljava.lang.Object;@a293444=[Ljava.lang.Object;@48a494bd
mvvar2: [Ljava.lang.Object;@60ffb376=[Ljava.lang.Object;@3da1a04d
============= Next attempt =============
- map_get_values("value",object_to_map(to_object("value", concat(data.page.facetRefinement.name, "=", data.page.facetRefinement.value)))) -> _experience.analytics.customDimensions.lists.list1.list.value
- add_to_array(to_array(true,to_object("","")), object_to_map(to_object("value", concat(data.eventInfo.component.type, "=", data.eventInfo.component.name)))) -> _experience.analytics.customDimensions.lists.list2.list
=== Result (from analytics.hit in AEP Assurance session) ===
mvvar1: BLANK
mvvar2: [Ljava.lang.Object;@db02553=[Ljava.lang.Object;@7265197f
============= Next attempt =============
- map_get_values("value",object_to_map(to_object("value", concat(data.page.facetRefinement.name, "=", data.page.facetRefinement.value)))) -> _experience.analytics.customDimensions.lists.list1.list[*].value
- add_to_array(to_array(false,null),object_to_map(to_object("value", concat(data.eventInfo.component.type, "=", data.eventInfo.component.name)))) -> _experience.analytics.customDimensions.lists.list2.list
=== Result (from analytics.hit in AEP Assurance session) ===
mvvar1: BLANK
mvvar2: [Ljava.lang.Object;@6d1bccea=[Ljava.lang.Object;@74360ab3
============= Next attempt =============
- add_to_array(to_array(false,null), concat(data.page.facetRefinement.name, "=", data.page.facetRefinement.value)) -> _experience.analytics.customDimensions.lists.list1.list[*].value
- add_to_array(to_array(false,null), concat(data.eventInfo.component.type, "=", data.eventInfo.component.name)) -> _experience.analytics.customDimensions.lists.list2.list.value
=== Result (from analytics.hit in AEP Assurance session) ===
mvvar1: [Ljava.lang.Object;@6a54ae68=[Ljava.lang.Object;@2da93725
mvvar2: [Ljava.lang.Object;@61d7f137
So, none of these worked (obviously). Also, when I tried to use wildcards in Calculated Fields (e.g. data.eventInfo.component[*].type) , when I tried (unsuccessfully) to save the changes I got an "parsing error in '['." error. Example:
There was an expression parsing error. The expression add_to_array(to_array(true,to_object("","")), to_object("value", concat(data.eventInfo.component[*].type, "=", data.eventInfo.component[*].name))) failed to parse com.adobe.aep.aexl.jexl.AexlScriptEngine$AepJexlEngine.parse:113@1:97 parsing error in '['.