Database publishing to child table - how to test for null $rx.asmhelper.childValues

I am building a database publishing template, and want to define an expression for the value to go into one of the destination child tables, with this logic:

if (Rhythmyx content item child value is empty string or null)
Put “foo” into the destination child row
else
Put “bar” into the destination child row
end

I am using $rx.asmhelp.childValues to get the value from the Rhythmyx content item. I am able to compare this expression against an empty string:

if ($rx.asmhelper.childValues($sys.item,“upcoming_webinars”,“upcoming_webinar_registration_url”) == “”)

and get the correct outcome, but I can’t find a way to test whether it is null.

I’ve tried

if ($rx.asmhelper.childValues($sys.item,“upcoming_webinars”,“upcoming_webinar_registration_url”)== null)

and

if !($rx.asmhelper.childValues($sys.item,“upcoming_webinars”,“upcoming_webinar_registration_url”))

and the JEXL empty function

if (empty($rx.asmhelper.childValues($sys.item,“upcoming_webinars”,“upcoming_webinar_registration_url”) ))

And in each case, I’ve gotten a Velocity error: Problem parsing expression

Has anyone succeeded in testing the result of $rx.asmhelper.childValues for null?

Thanks for any pointers -
Kathleen

Kathleen,

The function $rx.asmhelper.childValues returns a list, so testing the results for null values won’t work. The list may be empty, or the some of the values in the list my be null, but the list itself is not null.

If I understand your use case correctly, what you should do is process the list to check whether a specific item in the list is null, and if so, replace it with your preferred value.

RLJII

I understand that $rx.asmhelper.childValues returns a list. In the context of database publishing, this binding:

child[1].colname = $$rx.asmhelper.childValues($sys.item, “childtablename”, “fieldname”

results in the publishing process taking each child row from Rhythmyx and making a child row in the destination. I haven’t ever had to specify a particular index in the list in order to get it to publish properly.

Is there some way to specify “the current Rhythmyx child row” in the comparison expression?

-Kathleen

I’ve found that I’m unable to compare $rx.asmhelper.childValues to any value in a comparison expression. The binding works (putting a single value into each destination row) when it just refers to $rx.asmhelper.childValues, but when I try to put that into an expression, it treats the return value as a list. That seems very limiting - I can’t do anything other than just move values straight from source to destination, without any additional manipulation. I’m now forced to do the work I want to do in a database trigger in the destination database instead.

Anyone have any additional suggestions?

-Kathleen