1 Reply Latest reply on Dec 16, 2017 3:26 PM by Ulf Stockburger

    SQL connection during PDM convert task

    Marvin Stettner

      Hi guys,

       

      I have a new issue and i hope you can help me.

      My idea is that, that the PDM convert task (in my case to create any neutral format like x_T) create a folder with the name of the initiated user of the task.

       

      A little bit funny, because the option about the notification you can set the "Initiated By" - but not for the Output file details!

      Look here:

      2017-02-06 06_35_21-TEST_Ordner - Properties.png

      Anyway, now i have a little idea and something created. At first, i consider how i get the "Initiated By" information to the primary output path.

      1) Create a variable for the convert macro like S-061104

      2) Create a connection to the SQL Server

           a) Perform the SQL query

           b) Write the initiated by - text back to the variable

      3) Create the output file path!

       

      That's sound good and easy but i fail on Point 2). I created the right SQL query (SELECT Username FROM Users WHERE UserID = (SELECT InitUserID FROM TaskInstances WHERE InstanceGUID = 'TaskInstanceGuid');) and it work's. But i don't know how i can build a connection to the SQL Server (2008) and perfom the query (?), and on top, this in VBA during the convert task...

       

      If somebody could help or have any ideas, please answer me. I will desperate on this issue.

       

      Greetings,

      Marvin

       

      P.S.: A failed attempt for the part of the SQL query in VBA you'll find attached.

      P.P.S.: If we finished this macro i will publish this work.