Set valuein service with %% when variable is null

I have a flow service fs1 with need a variable a in input.
When I invoke the flow service fs1 into another flow service and I put the value of my variable a to %b% (and validate the checkbox Perform pipeline variable substitution), my value to a is b.
But when b is null, I expect to have nothing in a or null. I have %a% instead of. I’m wondering how I can change that

You could use a condition on the mapping line, i.e. let it execute only if b is not null. But I generally don’t like conditions on mappings because they are overseen very easily. Hence I’d probably first assign a default value to b, ant then assign b to a.

1 Like

Hello fml2,
Thanks for ur reply.
In fact I prefer have null value because for me, null is an information. (Espacially when I save in database).
I want to use a set value because in the an array I have in input and I didn’t want to make a loop to assign value

Using my approach, you’ll get a perfect NULL value in the database. IIUC, your problem was that you get the string “%a%” (three chars) if a has no value. My proposal should prevent that.

I know that works.
The things is I begin to have little experience of webMethods products but I learn about it every day.
So I Wonder if it exists some tricks to haven’t three characters when I set value %a% when a is NULL.
Something like bracket or slash or regular expression. I’m not blocked, just curious

Hi Vital,

Of course, you could branch on your variable and MAP it only if it not null.
A BRANCH on /./ will do the trick.

However, the response of fml2 * is certainly the way to go.

Strictly speaking, “/./” does not check for “not null”, but for a non empty string. To check for not null, you’d have to write “/.*/”. But since some DBs store empty strings as NULL, there might be no difference in the end.