Hello All,
I am facing issue with the following map. I am building dynamic filters. Here is the map is the output. But I wanted to delete logicalExpression:{} from the map. It can be there at any level. If logicalExpression is null then my resulted map should not contain logicalExpression:{}
a!localVariables( local!conditions: { a!map( operator: "AND", logicalExpressions: { a!map( operator: "AND", filters: { a!map(field: null, operator: null, value: null), a!map(field: null, operator: null, value: null) }, logicalExpressions: { a!map( operator: "AND", filters: { a!map(field: null, operator: null, value: null), a!map(field: null, operator: null, value: null) }, logicalExpressions: {} ), a!map( operator: "AND", filters: { a!map(field: null, operator: null, value: null), a!map(field: null, operator: null, value: null) }, logicalExpressions: {} ) } ) } ) }, local!conditions )
Discussion posts and replies are publicly visible
You ned to use a recursive approach... or try converting the array to json... replace the elements with a regular expression, and convert it again to an appian structure..
Can you pls give me an example for JSON approach
it would be something like....
a!fromjson(substitute(a!tosjon(local!conditions), "logicalExpressions"":[]", null))
But you have to be care to closing tags, and keep the json structure