This is a JSON-JSON transformation, transforming a boolean input ("true"|"false")
into a char output ('Y'|'N')
. So we go for something like:
varOutput: ('Y' when payload.varInput otherwise 'N')
But what if varInput is null? we got exception. I could control it with another when-otherwise:
varOutput: ('Y' when payload.varInput != null otherwise 'N')
when payload.varInput != null otherwise null,
This last one is null safe, but again, I feel there should be a more elegant way.
Use default
{varOutput: ( payload.varInput default 'N')
}
Or unless/otherwise is null safe and a bit more elegant:
{
varOutput: ('Y' unless payload.varInput !=null otherwise 'N')
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.