Io: how to set a property to null?

In on premise webMethods I can set a property to $null in a transform pipeline. How do I do this in the cloud version?

Double-click the variable to open the set value dialog. Don’t enter a value, but make sure “Include empty values for string types” is checked.
empyValue

1 Like

That’s not null, that’s an empty string, no?

@bastiaanr – can you clarify exactly where you are specifying $null? This “magic” literal cannot be used to set anything. It can be used to check if a var is null in a BRANCH in some other cases.

Setting a string var to “” is not equivalent to null. Such a var will not match $null.

If you need a var to be in the pipeline and explicitly set to null (which is rare – usually just drop the var) you can create Java service that accepts an input var that holds the name of the variable you want to create with a null value. But really, should just drop the var.

If you have more details about your specific scenario, the guidance can be refined.

3 Likes

Thank you for the answers. I’m talking about the cloud version of webMethods and want to set an attribute to null in a transform pipeline. I want it null because I want that the attribute still exists in the document but has no value. In my preference the existance attributes in a document is the same at runtime and design time.

If empty string works for you, go for it. Using null for a purpose other then checking if it exists or not is usually a bad idea. Even if your document validation requires it, I recommend updating your schema to accept empty string and use it that way. null is not a value, and it shouldn’t be used as value.

1 Like

Sure, but just keep in mind that null and empty string are not the same. As such, a var set to “” will not match $null.

Hi Bastiaan Rodenburg,

on cloud platform use “” to set null property.
see this implementation I’ve done earlier.
{F0C70533-0347-4F2B-9AB9-7D7E3F6A8B25}

Hope this will help you!

Regards,
Zainul Abideen

That is not null. That is an empty string. That will not match $null.

But if it does match in iPaaS with something like

BRANCH on ‘/leaveType’
…$null: SEQUENCE

Then that is good to know. But it is does not behave that way in Integration Server on-prem. An empty string is not the same as null.