UserWorksInProject

<< Click to Display Table of Contents >>

Navigation:  Programming Mechworks PDM > DBWCommandShell > Commands Reference > DBWArm >

UserWorksInProject

Description

With the DBWARM enabled, query if an user works in the assigned project.

Syntax

call DBWShell("UserWorksInProject UserID ProjectID")

Parameters

UserID

name of the user to query

ProjectID

project id to query the user about

Results

@OKWORKS

0: if the user is not assigned to that project
1: if the user is assigned to that project

Remarks

warningThe DBWARM must be enabled.

Example

Sub Main()

 DBWInit(TRUE)
 projectId = "Toy Tractor"
 userId = "Ciro"
 DBWShell("UserWorksInProject " & replace(userId," ","|") & " " & replace(projectId," ","|") )
 okWorks = DBWResult("@OKWORKS")
 if okWorks = 0 then
  DBWMsgBox userId & " does not work in project " & projectId & "." & vbcrlf & "I will add him now ..."
  DBWShell("AddUserToProject " & replace(userId," ","|") & " " & replace(projectId," ","|") )
 else
  DBWMsgBox userId & " works in project " & projectId & "." & vbcrlf & "I will remove him now ..."
  DBWShell("RemoveUserFromProject " & replace(userId," ","|") & " " & replace(projectId," ","|") )
 end if
 DBWShell("CloseSheet")
 DBWShell("OpenForBrowsing")
End Sub