Reputation: 3190
I need to optionally use an attribute if it exists, in an expression. I know I can use ifelse to determine this, however the attribute name is printed as a literal if it doesn't exist.
What is the correct expression to test for this?
${MyOptionalAttribute:notnull():ifElse(MyOptionalAttribute,'my default value')}
Upvotes: 0
Views: 2891
Reputation: 1230
Use a UpdateAttribute
processor:
MyOptionalAttribute
(dynamic property): ${MyOptionalAttribute:notNull():ifElse(${MyOptionalAttribute}, "default value")}
Upvotes: 1