Expand my Community achievements bar.

Convert XML Values from "null"

Avatar

Former Community Member
Using LiveCycle...



I call a web service from my form that queries a database for multiple rows and outputs an XML file. To bring that XML into the form, I have it converted to a string (in the process) and written into a text field once brought into the form. I then parse through and take the information I need.



My problem is some (but not all) of the database fields that have no value show up as the value "null". The rest show up as "". We can't have fields in the form populating with the word "null" so we have to change those somewhere. My thought was the best place to do so was to parse through the XML in the text field, find any value that equals "null" and replace it with "".



Is this the best way to go about doing this? If so, how can I use XPath to loop through all of the returned values and replace any instances of the word "null"?



My other idea was do it in the SetValue component that converts the XML into a string, but again, I don't know how to via XPath.



Thanks for the help!
1 Reply

Avatar

Level 9
Two thoughts:

1. You could probably write an XSLT tranformation to do this for you.

2. A better solution (probably) would be to would be to wrap the columns in your SQL statement with a function that would turn null values into blanks.



e.g.

http://cf-bill.blogspot.com/2005/10/oracle-nvl-microsoft-isnull.html



Howard

http://www.avoka.com