AlejandroBlancoTro | 2024-08-12 15:06:19 UTC | #1
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($ArrayValue1 = $Value1.replace(\",\",\"$esc.quote, $esc.quote\"))#set($ArrayDisplay1 = $Display1.replace(\",\",\"$esc.quote, $esc.quote\")){\"ArrayValue1\":[$ArrayValue1]},{\"ArrayDisplay1\":[$ArrayDisplay1]}" }
But I am only getting the first array: ArrayValue1. For the second array, ArrayDisplay1, is empty. If I set first {\"ArrayDisplay1\":[$ArrayDisplay1]} and then {\"ArrayValue1\":[$ArrayValue1]}, the opposite happens: ArrayDisplay1 has data but ArrayValue1 is empty.
Please, any idea?
Thnaks.
Jerome.Saint-Marc | 2024-08-12 17:09:51 UTC | #2
Hello,
As you mention that it is working when you use ArrayValue1 (as first) or ArrayDisplay1, 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,
AlejandroBlancoTro | 2024-08-12 20:12:04 UTC | #3
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($ArrayValue1 = $Value1.replace(\",\",\"$esc.quote, $esc.quote\"))#set($ArrayDisplay1 = $Display1.replace(\",\",\"$esc.quote, $esc.quote\")){\"ArrayValue1\":[$ArrayValue1], \"ArrayDisplay1\":[$ArrayDisplay1]}" }
Thanks again.
Regads.
system | 2024-09-12 20:12:15 UTC | #4
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 27832