Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Using importdata to import xml data into dynamic PDF form

Avatar

Level 8
Level 8
Hi again,



Me and my colleagues have a problem using the importData service to import some xml data into an empty PDF form (represented as an XFA input variable).



In the server log I get the error that Only XDP data is supported for XFA forms, however I only have the xml data and not the entire xdp available.



Is this really not possible to to (like importing xml data to a form is possible in the Designer when creating forms).



I hope the scenario is understandable



Sincerely

Kim Christensen

Dafolo A/S

Denmark



PS: During the various projects I am working on I keep running into problems...however I am totally new to LiveCycle so I consider this very informative learning steps and appreciate all your help :-)
16 Replies

Avatar

Level 10
XDP data doesn't mean you need the whole XDP definition in there. This is valid xfa data that works with the importData:<br /><br /><?xml version="1.0" encoding="UTF-8"?><xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"><br /><xfa:data><br /><form1><br /><TextField1>aaaaaa</TextField1><br /><TextField2>bbbbb</TextField2><br /><TextField3>cccc</TextField3><br /><TextField4>cddddd</TextField4><br /></form1><br /></xfa:data><br /></xfa:datasets><br /><br />If that's not good for you, then you can always the renderPDFForm from the LC Forms service to merge your data with the PDF.<br /><br />Jasmin

Avatar

Level 9
We have a pair of operations that will append and remove the XPD "envelope" elements from an XML file, inside an orchestration. These may help...

Check out



http://avoka.dnsalias.com/confluence/display/Public/XML+Utilities+DSC



Howard

http://www.avoka.com

Avatar

Level 8
Level 8
Hi again,<br /><br />I have been experimenting a little with both the renderPDFForm and importData services. However I don't seem to be ble to make them work as I need them to.<br /><br />My scenario is simple, I have one (call it a template xdp/PDF form) and lots of data in xml files (around 1000), that I need to import into the template. Therefore I have set up a "Watched Folder" to take the xml as a document (I guess this is a requirement) and then I need either the renderPDF or importData services to import the xml data into the template.<br /><br />I would like to know how I should setup the services to make this work.<br /><br />When I try to use importdata I setup the following:<br /><br />PDF document: set to be the template i need to import the xml to)<br /><br />Input data: the document variable (an xml file) that is passed to the Watched Folder<br /><br />Data merged PDF: set to an out xfaform<br /><br />When I do this I get an Coercion error in the server log:<br /><br />2007-11-15 13:27:05,324 ERROR [com.adobe.workflow.AWS] stalling action-instance: 1506 with message: ALC-DSC-000-000: com.adobe.idp.dsc.DSCRuntimeException: Internal error.<br /> at com.adobe.idp.dsc.util.CoercionUtil.toDOMDocument(CoercionUtil.java:656)<br /> at com.adobe.idp.dsc.util.CoercionUtil.toType(CoercionUtil.java:878)<br /> at com.adobe.idp.dsc.util.CoercionUtil.toType(CoercionUtil.java:803)<br /> at com.adobe.workflow.datatype.runtime.support.AbstractDataTypeRuntimeHandler.coerceFrom(AbstractDataTypeRuntimeHandler.java:64)<br /> at com.adobe.workflow.datatype.runtime.support.AbstractComplexDataTypeRuntimeHandler.getNode(AbstractComplexDataTypeRuntimeHandler.java:47)<br /> at com.adobe.workflow.dom.VariableElement.setBoundValue(VariableElement.java:93)<br /> at com.adobe.workflow.pat.service.PATExecutionContextImpl.setProcessDataValue(PATExecutionContextImpl.java:729)<br /> at com.adobe.workflow.pat.service.PATExecutionContextImpl.setProcessDataWithExpression(PATExecutionContextImpl.java:335)<br /> at com.adobe.idp.workflow.dsc.service.SetValueService.execute(SetValueService.java:46)<br />...<br />Caused by: ALC-DSC-119-000: com.adobe.idp.dsc.util.InvalidCoercionException: Cannot coerce object: <document state="passive" senderVersion="3" persistent="false" senderPersistent="true" passivated="true" senderPassivated="true" deserialized="true" senderHostId="127.0.0.1/172.16.10.125" callbackId="0" senderCallbackId="7" callbackRef="null" isLocalizable="true" isTransactionBound="false" defaultDisposalTimeout="600" disposalTimeout="600" maxInlineSize="65536" defaultMaxInlineSize="65536" inlineSize="8039" contentType="application/xml" length="-1"><cacheId/><localBackendId/><globalBackendId/><senderLocalBackendId/><senderGlobalBackendId/><inline><?xml version="1.0" encoding="UTF-8"?><br /><form1><br /> <sub_BlanketTop /><br /> <sub_SubjectTop><br /> <f...</inline><senderPullServantJndiName>adobe/idp/DocumentPullServant/adobejb_server1</senderPullServantJndiName><attributes file="c:\NCRConvert\ProcessForm\stage\Wx450d4b32843a0b0bcb8ef99e\NCR-00564_dXAE3soH.xml"/></document> of type: com.adobe.idp.Document to type: interface org.w3c.dom.Document<br /> at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)<br /> at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)<br /><br />However it is possible to manually import the xml data in Acrobat Professional without any problems.<br /><br />When I use the renderPDFForm with the following settings:<br /><br />Form to render: literal value that points to the template<br /><br />Form data: document variable from watched folder (xml)<br /><br />Content Root URI: repository://<br /><br />With these settings I also get a coercion error, however it does not seem to be exactly the same.<br /><br />Sincerely<br />Kim

Avatar

Level 10
The Data merged PDF output parameter has to be of type "document" no "xfaForm".



That's why you get a coercion error.



Jasmin

Avatar

Former Community Member
hi i have created a web service to get the values from a sql database. I want to bind the values to dropdown list. I'm using livecycle designer. I followed many procedure but i didnt get the proper result. I used XML file also but that doesnt fill in the dropdown.. Please help me out. Jasmin i hope u'll reply with favourable solution.

Avatar

Former Community Member
Hi all,



I have a pdf application developed in Adobe Designer, which can import and export xml data. The form can be used to submit the data to a web server as well.



I facing some problems in the following scenario:-



Consider a drop down field with values 1,2,3 and 4. I select 2 and export an xml and save it.

Now I make some changes to the form and remove the option 2 from the drop down field. Now if I try to import that xml into the form, the drop down displays 2, when in fact 2 is not an available option for that field. Moreover I am also able to submit the data with the wrong value in the field.



Can I take any remedial measures for this problem?

Avatar

Former Community Member
In the dropdown field properties make sure the Allow Custom Text Entry checkbox is not checked. This will allow you to add to the dropdown dynamically which is what you do not want.

Avatar

Former Community Member
Hi jasmin can form with filled data be directly exported to CSV file format? Actually i have done a web application in dot net to get XML saved to Access database. But my client asks if it would be done in the javascript.. If you have any idea reg. this issue plz let me know..

Thanks in advance

Avatar

Level 10
Acrobat has a method called exportAsText which can export the data as tab-delimited format. You might be able to use that if you export the data client side (from the PDF).



If you call it from the server side (within LC), I think you can only get XML.



Jasmin

Avatar

Former Community Member
Thanks for the reply Paul.



The Allow Custom Text Entry checkbox is not checked for any of the drop down fields in my form. But that does not stop any value from appearing in the drop down when an xml is imported into the form. It only restricts manual entry into that field for values other than those in the drop down list.

Avatar

Former Community Member
hi Jasmin,

Thanks for the reply. Now i have been trying to use Workflow designer and the form i designed in LC designer. I went through few articles for integrating this form. But i'm not clear how the form on clicking submit will invoke the workflow process.. Usually the general flow is like forms will be sent from Admin to Employee. Employee will fill and submit via email to customer. He reviews and then forwards to Admin. I've done using LC Designer and everything worked fine but the only drawback is that Admin needs to export as CSV format instead of XML.. I want to know if Workflow designer be helpful in doing this. If not workflow designer which one can do that from a PDF form.. I hope you will help me out with this issue..

Avatar

Level 10
I think your best bet would be to use the Script service and write a routine to convert your xml into csv.



Something else you can do is use the XSLT service and write an xslt to convert your xml into csv.



Jasmin

Avatar

Former Community Member
Hi Jasmin,

Thanks a LOT for the reply. I'm new to this LC and through many searches i have designed the PDF forms with validation and everything worked fine. I dont know how to use much of the scripts that you have mentioned in this reply.. If u have any article or samples please let me know so that i dont have to study through the LC Workbench process. Please mention some links for the script service to convert XML to CSV and also using XSLT service..

Avatar

Level 10
You can use the Script service (under Foundation) this allows you to write java code to manually do the transformation.



The XSLT service (also under Foundation) allows you to apply a XSLT transformation to any XML. In this case you would have to build the xslt file and then use it within that service.



You can find more info under the Workbench help (under Help menu)



Jasmin