Full disclosure here, this is my first ever post to an Adobe message board, and I have been working with Adobe LiveCycle ES4 for about 2 solid months. I have a separate program that will send a report file (in this case an Excel file) to a shared network folder, and I would like to leverage that data into my Dynamic form. I have been using a XML tools add in, and developer tools in Excel to export an XML file I can use in LiveCycle.
What I am hoping, or attempting, to do is have an end user type a number into a number field called "Thing2Field". They click a button to get the corresponding <Thing1> in the same row as a matching <Thing2> outputed to a text field called "Thing1Field". Make sense? My fruitless attempts:
Some may ask why I am using the .importData(); method. Long term in building this form I would like to create a representative node in which this imported data goes into. I have read that importing data from XML goes directly into the root.data?? node. If you were to import a second file it would overwrite the original becuase how the method and the DOM is setup. The data file I am working with in this example updates not so frequently and is in a different 'system' than another data file I would like to import. This other file would update frequently and has a lot more data present, it wouldn't be bound to the form but I need to call on the data to populate certain fields from it.
I am aware LiveCycle allows multiple instances of database connections through SQL and such, which we are moving toward, however I need to get a current working model to allow us to prove viability. Any help you could provide would be of great assistance. Thanks in advance for your time.
At the end of the day in order to get the drop down list to dynamically populate, the XML structure I was utilizing from the XML tools plug-in, in Microsoft Excel was creating the XML format I listed above. You could probably write an example to get rid of the individual <row> listed above by putting all of the <Thing1>'s together and <Thing2>'s together is what worked. Or if I wanted to maintain the relationship have <Thing1>CatInTheHat</Thing1> <Value1>Dr.Suess<Value1/>. I had to re-adjust my thinking on nodes and values in order to get this to work.
Radzmar was spot on as usual, using the importData() method is a little clunky and his solution to import the data as a string is a good viable alternative the way I was presenting the problem. Navigating the rules associated with the XML nodes is something I need to learn a lot more about.
Thank you for that reference. I have been reading up on this code block a little because I didn't recognize the .replace() command in there. I see it may be leveraging the EX4 extensions in acrobat. Is that correct? The purpose of the .replace function according to John Brinkman is:
"Oddly, E4X refuses to process the xml processing instruction at the front of an XML fragment. If it’s there, you will get a syntax error: “xml is a reserved identifier”. The workaround is to remove leading processing instructions with a regular expression such as:
sXML = sXML.replace(/^[\s\S]*?(<[^\?!])/, “$1”);" -J. Brinkman blog 22SEP2010
It seems to load the data into the form OK, but I am curious what would the string then look like in vImportXML? I would need to understand that variable if I am to write something that leverages the data in it correct? Thing1's and Thing2's from above are related in the XML to the same row. That sibling relationship is something I hope to leverage.
I can write a loop with an if statement condition that if no number matches messagebox a 'try again'. If the loop condition matches a Thing1 in vImportXML, I am am not sure how to output a sibling Thing2 to a 'thingField2'.