Help to split two strings and insert them into two array objects DataAction output

Hi,

Try to get two strings "a,b,c,d" and "1,2,3,4" inside of datatables and return them on two arrays using dataaction.

{
"translationMap": {
"Display1": "$.Display1",
"Value1": "$.Value1"
},
"translationMapDefaults": {},

"successTemplate": "#set($Array_Value1 = $Value1.replace(",","$esc.quote, $esc.quote"))#set($Array_Display1 = $Display1.replace(",","$esc.quote, $esc.quote")){"Array_Value1":[$Array_Value1]},{"Array_Display1":[$Array_Display1]}"
}

But I am only getting the first array: Array_Value1. For the second array, Array_Display1, is empty. If I set first {"Array_Display1":[$Array_Display1]} and then {"Array_Value1":[$Array_Value1]}, the opposite happens: Array_Display1 has data but Array_Value1 is empty.

Please, any idea?

Thnaks.

Hello,

As you mention that it is working when you use Array_Value1 (as first) or Array_Display1, I think the error is just in your successTemplate - too many {}

{
  "translationMap": {
    "Display1": "$.Display1",
    "Value1": "$.Value1"
  },
  "translationMapDefaults": {},
  
  "successTemplate": "#set($Array_Value1 = $Value1.replace(\",\",\"$esc.quote, $esc.quote\"))#set($Array_Display1 = $Display1.replace(\",\",\"$esc.quote, $esc.quote\")){\"Array_Value1\":[$Array_Value1], \"Array_Display1\":[$Array_Display1]}"
}

Regards,

Hi,

Thank Jerome for your support. You are right. The data action works with the followinf setting:

"translationMap": {
"Display1": "$.Display1",
"Value1": "$.Value1"
},
"translationMapDefaults": {},

"successTemplate": "#set($Array_Value1 = $Value1.replace(",","$esc.quote, $esc.quote"))#set($Array_Display1 = $Display1.replace(",","$esc.quote, $esc.quote")){"Array_Value1":[$Array_Value1], "Array_Display1":[$Array_Display1]}"
}

Thanks again.

Regads.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.