Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Check for 'null' doesn't work

Avatar

Former Community Member
Hello!



We've experienced a problem in Workbench regarding Boolean functions within XPath expressions. We aren't able to check whether a variable is null or not. An example:



>Process variable name:

b xy



>Process variable type:

b String



>Process variable value:

b null



>Xpath evaluation:

b is-null(/process_data/@xy) = true()



>Result:

b the Xpath evaluation returns false!!



Does anybody see the problem?

Thanks,

Nico
4 Replies

Avatar

Former Community Member
We could find the reason for this problem:



Accessing a process variable using XPath does never return 'null' as value! Assuming the variable xy is 'null' the following XPath statement returns an empty string (""):



> /process_data/@xy



Therefore: use the following Xpath statement to check a string variable for null:



> /process_data/@xy = ""



The is-null() function doens't work for string variables.



Regards,

Nico

Avatar

Level 2

Doesn't work for document variables too!

/process_data/@document = "" also works..

I know it's a 2 year old thread, but it's still a problem in ES2!

Avatar

Former Community Member

In my experience the is-null function works for SetValue but not for route conditions. Not sure why. I realize this is an old post, but I just came across it.

-Nissan

Avatar

Former Community Member
point taken,will look into it and see if we can enhance it for future release

thanks