17 Replies Latest reply on Sep 28, 2011 1:13 PM by pguerett

    Can't import XML data into my databse-connected PDF form

    Steppedweller

      Hi  All

       

      Excellent forum, and thanks for all the revealing insights so far viewed, however one question.I'm using a PDF form to collect info via email in the format of XML datafiles. I also have an identical PDF which has database connectivity and that works fine. It was suggested on this forum that I could then import the XML data into my Database via the DB-connected PDF, in effect a user form and one with DB connectivity. Now, I've checked the data types and they all match, but when I import XML file, it creates a blank record in the database and none of the information is carried through. Please could someone offer guidance on what I'm doing wrong, I've been trying to figure this out for a week now?

       

      Thanks

       

      Steppe

        • 1. Re: Can't import XML data into my databse-connected PDF form
          pguerett Level 6

          My guess is that the bindings are messed up. The Data Bindings are waht is used to bind the inbound and outbound XML data. I assume that when you import the aml file into your form teh data is appearing in the fields ...correct? If so now it becomes an update database issue. Depending on how you are doing the update (either through a SQL command or using the addNew and Update functions) will help us figure out what to do next.

           

          If I do not do an import and merely try to add modify the current data and add that as a new record does that work?

           

          Paul

          • 2. Re: Can't import XML data into my databse-connected PDF form
            Steppedweller Level 1

            Hi Paul

             

            The data does not appear in the fields when I try to import the XML file. I click add new on the DB connected form, use the “manage form data”> “import data” from the forms drop down on the menu bar, I find the appropriate XML file, click it and nothing appears in the fields. I’ve checked the DB connected form and typed in records using the “add New” button and then “update” and the record is successfully imported into the database. It seems to be an issue between the user form, which creates the XML file when submitted and the DB connected form. I use an SQL statement for my data connection as the table in the database has an “auto increasing” field. Hope this makes things clearer and thank you very much for your help.

             

            Cheers

             

            Steppe

            • 3. Re: Can't import XML data into my databse-connected PDF form
              pguerett Level 6

              Ok so the issue is in the bindings between the XML data file and the form that you are loading it into. Can you look at the bindings of one of the fields and tell me what it is set to?

               

              Paul

              • 4. Re: Can't import XML data into my databse-connected PDF form
                Steppedweller Level 1

                Hi Paul

                 

                The binding on my DB connected form is set to {$record.EquiptechsDB.Last_Name}, but that is in the “default Binding” box, I’ve just noticed that there is another binding box that has “Import/Export bindings (Execute)”, and that is blank.

                • 5. Re: Can't import XML data into my databse-connected PDF form
                  pguerett Level 6

                  That is fine ...the Import/Export bindings are used for Web Services (and you are not using them so it shoudl be blank). OK so you have bindings that means that the imported XML file is not following the structure that was setup in the bindings. I suggest that you create a new DataConnection and choose sample XML Data as the structure for yor data connection. When asked point to your data file. This will create a hierarchy view of the data file and you can drag and drop the fields from the hierarchy that are supposed to make to the fields on your form. This will modify the bindings to match the structure of the inbound data file. One more thing, can you open the data file in a text editor and validate that there is data in the xml file (you shodul do that first)?

                   

                  Paul

                  • 6. Re: Can't import XML data into my databse-connected PDF form
                    Steppedweller Level 1

                    Thanks Paul

                     

                    Checked the xml on xml editor and data is there. So, I’ve done that and set up a new data connection and dropped them into the relevant fields. I’ve then saved it, opened it up again and it’s collected the xml data successfully, but how do it now get it into the database, as the fields are now bound to the xml and not the database, so the buttons don’t work now to “add new” and “update”. Sorry for being a novice at this.

                    • 7. Re: Can't import XML data into my databse-connected PDF form
                      pguerett Level 6

                      You can write the data to the database using a SQL statement instead of the buttons ….or ……..you could modify the two forms to match the structure of the DB and bind to that so that the DB schema and the form structure are the same.

                       

                      Paul

                      • 8. Re: Can't import XML data into my databse-connected PDF form
                        Steppedweller Level 1

                        Thanks Paul

                         

                        I’m sure I’m nearly there, this is the latest error message I get;

                         

                        “Error unable to create SOM expression $record.EquiptechsDB.Decam_Done”

                         

                        Where EquiptechsDB is the name of the DB connection and Decam_Done is one of the fields.

                         

                        I get this message every time I try to update to the DB after importing the XML file onto the form. This field is a “text drop-down” on the DB and on the form, I have a couple of other drop=downs as well.

                         

                        How do I write an SQL statement to write the data to the DB, for I do this in Access, which the DB format I am using.

                         

                        Thanks for your help so far.

                         

                        Cheers

                         

                        Paul

                        • 9. Re: Can't import XML data into my databse-connected PDF form
                          pguerett Level 6

                          Check the bindings on that field .....it shoudl not be referencing the DB connection.

                           

                          To be able to execute a SQL commanmd against your db follow this blog:

                           

                          http://forms.stefcameron.com/2006/09/29/selecting-specific-database-records/

                           

                          Paul

                          • 10. Re: Can't import XML data into my databse-connected PDF form
                            Steppedweller Level 1

                            It’s not, it binds to the XML sample connection, as do the others, any ideas?

                            • 11. Re: Can't import XML data into my databse-connected PDF form
                              pguerett Level 6

                              There should be no reference to that DB connection …..open the dataConnection window and see if there is a binding icon present if so that is where the error is coming from.

                               

                              Paul

                              • 12. Re: Can't import XML data into my databse-connected PDF form
                                Steppedweller Level 1

                                No, that’s all good, checked and no binding icon on that database connection, However I’ve been looking through the xml souce page for the form as a whole and found this;

                                 

                                 

                                Which is odd as no other field is specifically mentioned to delete, it doesn’t make sense as to why this bit is in there, what do you think?

                                • 13. Re: Can't import XML data into my databse-connected PDF form
                                  pguerett Level 6

                                  I think you missed pasting something into the message ....what is it you found?

                                   

                                  Paul

                                  • 14. Re: Can't import XML data into my databse-connected PDF form
                                    Steppedweller Level 1

                                    I’m no expert on scripting, but this passage seems to relate to specifically deleting that field. As you follow the script down the page you get the script for each of the buttons, they sizes, colour and what they do etc, first, last, add new, update and delete, each button follows systematically down the script, then after that is the bit I pasted, which is the only field referred to in that way, the “Decam_Done” field, but maybe I’m wrong, but clearly this field is causing some issue.

                                    • 15. Re: Can't import XML data into my databse-connected PDF form
                                      pguerett Level 6

                                      I must be mssing something but there is no passage in the message I do not know what script you are referring to!

                                       

                                      Paul

                                      • 16. Re: Can't import XML data into my databse-connected PDF form
                                        Steppedweller Level 1

                                        Maybe it's because I'm replying by email, so I'll try the forums directly;

                                         

                                        </script>

                                                    </event>

                                                    <assist>

                                                       <toolTip>Click to delete the current record fromthe database</toolTip>

                                                       <speak priority="toolTip"/>

                                                    </assist>

                                                 </field>

                                                 <field name="Decam_Done" y="44.45mm" x="165.1mm" w="28.575mm" h="13.707mm">

                                                    <ui>

                                                       <textEdit>

                                                          <border>

                                                             <?templateDesigner StyleID aped3?>

                                                             <edge stroke="lowered"/>

                                                          </border>

                                                          <margin/>

                                                       </textEdit>

                                                    </ui>

                                                    <font typeface="Myriad Pro"/>

                                                    <margin topInset="1mm" bottomInset="1mm" leftInset="1mm" rightInset="1mm"/>

                                                    <para vAlign="middle"/>

                                                    <caption reserve="4.2353mm" placement="top">

                                                       <font typeface="Myriad Pro"/>

                                                       <para vAlign="middle"/>

                                                       <value>

                                                          <text>Decam_ Done</text>

                                                       </value>

                                                    </caption>

                                                    <border>

                                                       <edge/>

                                                       <corner thickness="0.175mm" join="round" radius="2mm"/>

                                                    </border>

                                                    <bind match="dataRef" ref="$.Decam_Done"/>

                                                    <validate nullTest="error"/>

                                                 </field>

                                                 <?templateDesigner expand 1?></subform>

                                              <proto/>

                                              <desc>

                                                 <text name="version">8.2.1.3144.1.471865.466429</text>

                                              </desc>

                                              <?templateDesigner expand 1?></subform>

                                           <?templateDesigner DefaultLanguage FormCalc?>

                                           <?templateDesigner DefaultRunAt client?>

                                           <?acrobat JavaScript strictScoping?>

                                           <?templateDesigner Grid show:0, snap:1, units:0, color:ff8080, origin:(0,0), interval:(125000,125000)?>

                                           <?templateDesigner FormTargetVersion 26?>

                                           <?templateDesigner Zoom 75?>

                                           <?templateDesigner Rulers horizontal:1, vertical:1, guidelines:1, crosshairs:0?>

                                           <?templateDesigner SaveTaggedPDF 1?>

                                           <?templateDesigner SavePDFWithEmbedded

                                        • 17. Re: Can't import XML data into my databse-connected PDF form
                                          pguerett Level 6

                                          There doesn't seem to be anything wrong with the passage ......you can try and rebind the field to see if it makes a difference.

                                           

                                          Paul