1 Reply Latest reply on Aug 27, 2008 4:32 AM by HowardTreisman

    Convert XML Values from "null"

    Ryan Lunka Level 3
      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. Re: Convert XML Values from "null"
          HowardTreisman Level 1
          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