Ifelse with null

I have 5 different fields in the form of customer’s feedback. I’m attempting to create a calculated field that will combine all the feedback into one field using concatenate and ifelse.
Some of the fields are null but I only want the field that is not null to be returned.

See below;
concat(
ifelse( isNull({feedback1}), Null, concat('Great: ', {feedback1}),
ifelse( isNull({feedback2}), Null, concat('Common: ', {feedback2}),
ifelse( isNull({feedback3}), Null, concat('Fair: ', {feedback3}),
ifelse( isNull({feedback4}), Null, concat('Yes: ', {feedback4}),
ifelse( isNull({feedback5}), Null, concat('Maybe: ', {feedback5})
)))))).
What I’m trying to do is for the feedback to return nothing if the field is null but to return the feedback field if the field is not null.
Unfortunately the code is returning error and I couldn’t figure out where the error is coming from.

Hello @Temik - Thank you for posting your query. It seems the problem is with your ordering of parenthesis and the NULL keyword. Can you please try the below expression. Let me know if this works!

concat(
ifelse( isNull({feedback1}), NULL, concat('Great: ', {feedback1})),
ifelse( isNull({feedback2}), NULL, concat('Common: ', {feedback2})),
ifelse( isNull({feedback3}), NULL, concat('Fair: ', {feedback3})),
ifelse( isNull({feedback4}), NULL, concat('Yes: ', {feedback4})),
ifelse( isNull({feedback5}), NULL, concat('Maybe: ', {feedback5}))
)

2 Likes

Thank you @sagmukhe. It worked! :smile:

@Temik - Great to know that! May I request you to mark the relevant post in that case as “Solution”? That would help the community to find answers to similar questions. Thanks again!

1 Like