2 Replies Latest reply on May 5, 2014 12:42 PM by Mike Gann

    Read card variable ini EPDM Task Addin  - OnTaskRun subroutine

    Mike Gann

      I need to read a card variable in the onTaskRun procedure in a Task Add-in.

       

      In non-task add-ins I've been able to use this to read the revision variable from the data card.

       

                     Dim vars As IEdmEnumeratorVariable8 = poCmd.mpoExtra

                     Dim Revision As String = Nothing

                     vars.GetVar("Revision", "@", Revision)

       

      I tried this in the task add-in OnTaskRun procedure and the task fails. With only this line added the task will fail:

       

                     Dim vars As IEdmEnumeratorVariable8 = poCmd.mpoExtra

       

      Thanks,

       

      Mike

        • Re: Read card variable ini EPDM Task Addin  - OnTaskRun subroutine
          Simon Turner

          You need to read the API Help for the EdmCmdData Structure.

          You will see that you get passed different data for each type of event that your addin handles.

          For OnTaskRun, mpoExtra points to the Task rather than a file.

          mlObjectID1 will be the ID of the file, so you need to get the IEdmFile5 object from that, and then you can set vars equal to that.


            • Re: Read card variable ini EPDM Task Addin  - OnTaskRun subroutine
              Mike Gann

              Hi Simon -

               

              Thanks for the pointers, that is exactly what I needed! Here's what I ended up with (Revision and Status are read from the file card):

               

                      Dim FileID As Integer

                      Dim info As EdmCmdData

                      info = ppoData(0)

                      FileID = info.mlObjectID1         'Selected files ID

               

               

                      Dim vault As IEdmVault5

                      vault = poCmd.mpoVault

                      Dim FileObject As IEdmFile5

                      FileObject = vault.GetObject(EdmObjectType.EdmObject_File, FileID)

                      Dim vars As IEdmEnumeratorVariable8

                      vars = FileObject.GetEnumeratorVariable

               

               

                      Dim Revision As String = Nothing

                      Dim Status As String = Nothing

                      vars.GetVar("Revision", "", Revision)

                      vars.GetVar("Status", "", Status)

               

               

              Thanks for the help!

               

              Mike