7 Replies Latest reply on Sep 22, 2017 4:36 AM by Wayne Marshall

    Generating an XML list to imprt into EPDM

    Scott Smith

      Hi guys,

      I was wondering of anyone could help  through the process of creating and importing an XML file to which EPDM will import please? I cant seem to find any documentation which tells you how to create an xml file for EPDM to then import. Also how does EPDM then add  future imports to the list or does it just replace the list?

       

      Also does it have to be an XML can it be a csv file? As I have managed to create a list as a csv.

      Thanks

        • Re: Generating an XML list to imprt into EPDM
          Tim Webb

          Hey Scott,

           

          For importing XML into PDM to update PDM datacards, take a look at this thread. There are a few gotchas but it works well. Yes, it has to be an XML file, not CSV. This process is used for updating datacard fields only, not creating new documents.

           

          Here's the general idea: The XML import updates files in PDM after they have been used to create a part/item master in your ERP system first. The ERP is basically sending updated BOM data back to part master files in PDM so they stay synced.

           

          PDM reads the XML file and searches PDM for a document with a datacard variable named the value of the "idattribute" tag and has a value of the "id" tag, then updates the all variables indicated under the <configuration name=... tag.

           

          Use alias sets to map PDM variable names to your ERP variable names so you can simply do a raw XML export from your ERP without worrying about converting variable names.

           

          PDM variable "Cost" = ERP variable "material_cost"

          PDM variable "Material" = ERP variable "material_name"

          PDM variable "Finish" = ERP variable "material_finish"

           

          Also, here's the basic layout you need for each incoming XML file. This XML will do the following:

          • Search for a file in PDM with a datacard field called "PDMDocID" with a value of "2808015"
          • Update the cost variable with value 4.27
          • Update the materialvariable with value ABS-PC
          • Update the finish variable with value Bead Blast

           

          Caution: PDM will only update those datacard variables under the <configuration name=... tag if they are mapped to SW custom properties.

           

          <?xml version="1.0"?>

          <xml>

            <transactions>

              <transaction

                date="1384361754"

                type="wf_import_document_attributes"

                vaultname="your vault name">

                <document

                  aliasset=""

                  pdmweid="0"

                  idattribute="PDMDocID"

                  id="2808015"

                  idcfgname="">

                  <configuration name="enter the configuration to find">

                    <attribute id="1" name="Cost" value="4.27"/>

                    <attribute id="1" name="Material" value="ABS-PC"/>

                    <attribute id="1" name="Finish" value="Bead Blast"/>

                  </configuration>

                </document>

              </transaction>

            </transactions>

          </xml>

           

          To ensure I don't end up updating the wrong file by searching for a datacard value that "might" get duplicated, I wrote an add-in that grabs the PDM DocumentID and updates the datacard field "PDMDocID" with the PDM DocumentID from the database so the file is truly unique according to the ERP and can be easily tracked and searched with in PDM. I use it for my own needs and give it away free to our clients who sign up for our monthly PDM consulting subscription.

           

          Good luck.

          Tim CEPA

          Believe in The Q!

          • Re: Generating an XML list to imprt into EPDM
            Wayne Marshall

            Hi Scott,

             

            By using an XML import rule, it is possible to import list values and the “links” for “controlled by variable” lists from an XML formatted file. There isn't really anything in the Help / Administration guide but there is a (not public) KnowledgeBase article with an example file in there.  As I think you are only looking to import a simple list I've stripped out the extra sections that define the parent / child relationships between linked lists - We use this with a PDM plugin that generates the XML file from an SQL query, for a Customer who requires a PDM Template to allow for 'dynamic' Project / Sub Project selection. The XML file is recreated when a new project / sub project is created.

             

            The example file has a full header containing all the supported attributes in the XML schema, but I've removed most of it to just have a simple file below...

             

            This creates a list called 'MY-Materials' in a vault called 'EnterprisePDM' - you should change to suit...

             

            <?xml version="1.0"?>

            <!DOCTYPE xml [

              <!ELEMENT xml (transactions)>

                <!ATTLIST xml ignored (-1|0) "0">

                <!ELEMENT transactions (transaction)+>

                  <!ELEMENT transaction (document|notification|list|serial_number|bom)+>

                    <!ATTLIST transaction type (wf_import_document_attributes|import_notifications|import_lists|import_serial_numbers) #REQUIRED>

                    <!ATTLIST transaction date CDATA #REQUIRED>       <!-- Seconds since 1 Jan 1970 00:00 -->

                    <!ATTLIST transaction ignored (-1|0) "0">

                    <!ATTLIST transaction vaultname CDATA #REQUIRED>

             

                  <!ELEMENT list (item+,link*)>

                    <!ATTLIST list name CDATA #REQUIRED>

                    <!ELEMENT item EMPTY>

                      <!ATTLIST item item_name CDATA #REQUIRED>

                    <!ELEMENT link EMPTY>

                      <!ATTLIST link source_variable CDATA #REQUIRED>

                      <!ATTLIST link list_variable CDATA #REQUIRED>

                      <!ATTLIST link link_value CDATA #REQUIRED>

             

            ]>

            <!--To use the dtd in an external file: <!DOCTYPE xml SYSTEM "filename.dtd">-->

             

            <xml>

              <transactions>

             

            <transaction type="import_lists" date ="123459" vaultname ="EnterprisePDM">

             

            <!-- Just a list without links -->

            <list name ="MY-Materials" >

            <item item_name ="Ceramic"/>

            <item item_name ="Ferrous Metal"/>

            <item item_name ="Nonferrous Metal"/>

            <item item_name ="Superalloy"/>

            </list>

             

                 </transaction>

             

              </transactions>

            </xml

             

             

            Good luck...

             

            Wayne