8 Replies Latest reply on Jun 25, 2013 11:50 AM by Sergi Moreno

    Send information from EPDM Data card to SQL

    Sergi Moreno

      Now, I'm take information of one SQL database for assign properties on my datacards using SQL querrys and some VB code in one dll for walk throught the Database.

      It's possible to write this database using properties of the epdm datacards? (Executing this dll in the approval flow)

      Can you send me some example of "take/pick properties and write in a database"?


      Thanks (and sorry for mi english)

        • Re: Send information from EPDM Data card to SQL
          Jeff Sweeney

          I assume you mean a 3rd party SQL database? You'll need to create an add-in to do this.

            • Re: Send information from EPDM Data card to SQL
              Sergi Moreno

              Yes, I want to write in a 3rd party SQL DB.


              The problem is that I still learn VB and would be a great help if someone can send me (or write here) an example of VB code of how read the properties of the datacard and how write in a SQL database. I know about how create and add-in, I only need some example of the VB code for do the function. With this "base code" I will can write the rest of it.

            • Re: Send information from EPDM Data card to SQL
              Sergi Moreno



              1) Can somedy write me an VB example, that I can modify and execute douring de aprovat flow.


              2) For other side, it's possibe to use a task for update datacard information reading an other SQL database (update cost prices?, I know how doing thisone but only went I change manualy datacard propieties and I need a task for update without checkout the file



              • Re: Send information from EPDM Data card to SQL
                Tim Webb



                You are requesting a great deal of code. In fact, you are requesting a "project" and it may be better to pay a consultant to assist you.


                Do you have the EPDM API help? If you do not have it, look in the EPDM installation disk in the "\Support\API\" folder for a file named "API_GB.chm". Use that API help file to guide you through getting data from datacard variables.



                The "GetVar" function is what you need after getting the variable interface using "IEdmEnumeratorVariable8"


                Private Sub EnterNewAuthor(ByVal pFile As IEdmFile5)

                On Error GoTo ErrHand

                    'Make sure that the file is checked out

                    If Not pFile.IsLocked Then

                        MsgBox("The file must be checked out.")

                        Exit Sub

                    End If


                    'Obtain the variable interface

                    Dim pEnumVar As IEdmEnumeratorVariable8

                    pEnumVar = pFile.GetEnumeratorVariable


                    'Get the current value of the Author variable

                    Dim sAuthor As String

                    Dim oAuthor As Object

                    If pEnumVar.GetVar("Author", "", oAuthor) Then sAuthor = oAuthor


                   'Let the user enter a new value

                    Dim sMsg As String sMsg = "The current author of " + pFile.Name + " is '" + sAuthor + "'."

                    sMsg = sMsg + vbLf + "Please enter a new one:"

                    sAuthor = InputBox(sMsg)


                   'Update the variable value

                    pEnumVar.SetVar("Author", "", sAuthor)


                    'Flush the value to the file and close the file.


                    Exit Sub



                    Dim sEname As String

                    Dim sDesc As String

                    pFile.Vault.GetErrorString(Err.Number, sEname, sDesc)

                    MsgBox(sEname + vbLf + sDesc)

                End Sub



                As far as writing to a different SQL database, my recommendation is to use Microsoft's technet to help you learn how to connect to another SQL database, see if the necessary tables exist, if not create them, write new rows to the table, and close the connection properly.


                There are several threads on this forum in the API section that can help you.


                Good luck on your journey.


                Tim CEPA


                • Re: Send information from EPDM Data card to SQL
                  Sergi Moreno



                  Thanks for you recomendations but we are a very small factory and we can't spend more money (it's hard for us to pay SW and EPDM apps and I had to buy EPDM without VAT implementation and I implemented it using the EPDM Administration guide) and I would like to try to doing myself this connector, learning VB and the EPDM API Guide.


                  I will still try to learn more, for submit you more concrete questions.