I am using the standard SQL QPAC to fetch list data from a database. As we already know, the standard SQL APAC cannot retrieve multiple rows, but I use the "FOR XML AUTO" in my SQL statement so that all rows are returned in XML format.
I now only need to parse the XML and put the items into my drop-down list.
Does anyone have script samples that can parse XML from within LiveCycle? You would think that the capability exists since the product is based on xml/xfa.
HowardTreisman, Jun 5, 2007 3:18 AM
Are you looking to parse it in a script qpac? If so then you can store the XML in an xml process variable, then use getProcessDataValue() from PATExecutionContext to retrieve a Document object for the DOM.
I tried putting the following XML into an xml variable, but I received an error instead:
Do you know precisely how to perhaps get the proper XML results from a SELECT statement that will go into an XML variable? I used "SELECT CLIENT_NAME as item from clients as list ORDER BY CLIENT_NAME FOR XML auto, elements" and I'm using a standard SQL QPAC to return the XML results.
Once I get the XML properly into the XML variable, I will try to use the getProcessDataValue() method.
If you have problems doing it that way, you can also download our SQLPlus QPAC, which will allow you to iterate over a result set and format the output in a number of ways, including a simple comma separated list. You can then use a simple script in the form to unpack the list into a dropdown.
It may be just as simple to write a QPAC that does the query and returns a comma-delimited list as a string. You could then have the form take that string as a hidden field and parse it into the drop-down list in the same method that Workflow provides the submission choice drop-down list.
You all provided very good solutions that I may try someday. I really mean that, but my intention with this particular workflow is to use only the tools I get out of the box. I really want to know the base components well so that I get a full understanding of what the provided QPACs can and cannot do.
That way I get to learn about how to use some of the loosly documented methods like getProcessDataValue(). Forgive my ignorance, can anyone please tell me how I am to script a call to this method, if you have used it already?
You're getting an error because that XML is not well formed so a DOM cannot be built for it. There needs to be a root node, something like enclosing all that in ....
I'm attaching a simple workflow I exported. It sets the value of an XML variable, and then using a script QPAC to call getProcessDataValue() and retrieve a Document object that can be used to parse the XML.
Did you ever have any luck with this? Any additional pointers?
I think I am going to do something similar. I am planning on sending in an email that contains XML data of just 9 fields (collected from a form online - outside of the LC system and then using the Email Receiver to collect the email. The email body is the XML data). So, I need to parse this out and set the elements to variables to populate my PDF form.
If I get something working, I will try to post back.
Actually, I ended up doing something a little different.
Since I only have 9 fields to get parse, I did use the Set Value QPAC, but I used substring-after and substring-before functions. I had to do this in two different Set Value QPACS, I couldn't group them together for some reason. So, the body of the email contains my XML data and I set the body to a variables and then parse it out in those 2 Set Value QPACS.
I could not able to retrieve the remote xml file(which means from server to another server) in Mozilla Firefox and some times inn IE also.
I found the Error: "Error: uncaught exception: Permission denied to call method XMLDocument.load"
It's a little difficult to work out what you're doing from your posting.
I suspect it may be that you're trying to load a document in Reader. This is not allowed, you must use Acrobat. (Or reader enable the form.)