Getting the path of a process

  • 1 August 2005
  • 3 replies
  • 1 view

Badge +2
Hi All,

Is there a way to get the path of a process with only providing the process name? I wanna do this in code.

Thanks

3 replies

Badge +9
Hi Van,

When you say path, are you referring to the full process name e.g. ProjectNameProcessName?

Please explain to me your scenario and I will be able to assist.

Regards,
Renier
Badge +2
Hi Renier,

I want to do the following:

;Authentication=Windows;SecurityPackage="


' Set The DataField Mappings

Dim sConStr as String
sConStr = "Server=" & sServer + ";"
sConStr &= "Integrated Security=SSPI;"
sConStr &= "DataBase=test;"

Try

SqlConn.ConnectionString = sConStr
sqlComm.CommandType = System.Data.CommandType.StoredProcedure
sqlComm.Connection = sqlConn

sqlComm.CommandText = "SCANREQUEST_DEST"

Dim NewParam As New System.Data.SqlClient.SqlParameter("@REQID", System.Data.SqlDbType.BigInt )
NewParam.Direction = System.Data.ParameterDirection.Input
NewParam.Value = K2.ProcessInstance.DataFields.Item("REQID").Value
sqlComm.Parameters.Add(NewParam)

OpenConnection(sqlConn)

Dim rReader As System.Data.SqlClient.SqlDataReader
rReader = sqlComm.ExecuteReader
While rReader.Read
K2.ProcessInstance.DataFields.Item
K2.Process = rReader.Item("PROCNAME")
Exit While
End While
rReader.Close()

Catch ex As System.Exception
Throw New System.Exception(ex.Message)
End Try

sqlConn.Close()
K2.Synchronous = False
End Sub


In brief: We want to read a process name out of the database then excecute that process by using an IPC call. We only save the process name in the database as 'PROCNAME' but IPC calls uses the following 'SOLUTIONPROJECTPROCNAME'. I know i would be able to get the full process name out of the K2 db but isnt there a much simpler way?

Thanks
Badge +9
Hi Van,

Accessing the K2.net DB is not advisable :? , the K2MNG object model allows one to get hold of the collection of processes available on the K2.net Server and will be a cleaner way to do so. Please have a look at the K2MNG object model documentation located in the K2.net Help file under the References section for more information about K2MNG. From a performance point of view I would prefer to make one call to the database you make use of instead of having to make another to the K2.net Server.

Below is a typical sample of the code generated by the IPC Event Wizard , please note that you only need to specify the Full Process Name (ProjectNameProcessName), the solution is not required.

;Authentication=Windows;SecurityPackage="

' Set The Process
K2.Process = "ProjectNameProcessName"
K2.Synchronous = True

' Set The DataField Mappings

End Sub


Just a couple of questions:

Is it possible to store the Project name as well, at the time that you store the Process name?
Are all your Processes part of the same project?
Can you predict the Project name?
How do you Get the Process Name before storing it to the DB?

Cheers,
Renier

Reply