Property null value checking?

Hi. I’m using mediator 7.3.1, and the good thing about it is that when I set the property, I can take the value from the XPath statement( from the payload ) directly. However, assuming I have this set statement and assuming my payload might not have a value for SomeID, so the value for JobID is null. However in my “If”, I can’t seem to check for null/empty values in my property JobID.

This is my if statement :














However, mediator throws out an error saying :
"Mediator Internal Error: No on_error sequence found. Exception: “com.softwareag.xbridge.exceptions.SequenceException: no “value” attribute for conditional expression” in sequence “http://localhost:8080/Bizwork/Sequence/MA001A.xml” at line 19."

May I know how to solve this?
Thanks.

Did you try checking the existence of the property using

<if property="JobID" relation="exists">

?

Kind regards,
Rolf

I tried using the “exists” relation. But my JobID property always exist, even if there’s no such node //SomeID in the statement. I tried logging it after the set statement, and this is part of the result.

<-----
Message ID = a2220f~fdd65b59c8797d@sagfranp4
Time = 2004-07-19 16:58:04.122
Original Message ID = 3bc20e~fdd65b4287
7f77@sagfranp4
Sequence Line = 18, Statement = step
Sequence URL = http://localhost:8080/Bizwork/Sequence/MA001A.xml

---------------------------
xbd.logger.message = See value of JobID

---- Properties -----
JobID =
xbd.current.contentID = xq1
xbd.current.contentID.URL = cid:xq1
*********************************************

Thus the property JobID will exist, but value is empty/null.

I believe you have stumbled upon a Mediator Studio error. It seems that the Studio property page for the IF statement will not let you enter a blank or null for the value property.

You can manually edit the sequence and make the value attribute anything you like - but:



this will cause Mediator to choke - it wants a something in the value attribute;



this is OK - but it won’t match in case the property being tested was set by an XPATH where the resulting nodeset was zero - which is your case.

One workaround is to set another property thus:



and test if the count was zero or not. then you can either set JobID using the XPATH or set it to a default ‘not exists’ value (or indeed don’t set it at all…)

regards,
- arp

Hi arp. Thanks for the tip. I also did some changes to the workaround as there are cases where my “SomeID” node does exists, but contains no value, ie . Thus the count() function will still return a non-zero value.

What I did was :




which works for my case as my “SomeID” node will always be a number value if it exists.

Looks like the processing of exists/equal in the Sequencer (not in the Studio) is asymmetric.
exists checks if the property exists (independent of the value).
equal checks (for the value part) if the value exists and if it is not an empty string.
So there is no direct way to check a property value against an empty string.

Kind regards,
Rolf

Hi Kookie,

You can also use the count() function to test for null. Using your example:


The zero value for the property indicates that the JobID property would be null.

Checking for null property values is planned for a future release.

Best regards,
Mike