KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Check number of 4D Write/Write Pro current users on 4D Server
PRODUCT: 4D | VERSION: 16R4 | PLATFORM: Mac & Win
Published On: September 8, 2017

A new 4D command Get license info in v16R4 displays license information as an object. One of the properties that the object contains is the current users for 4D Write/Write Pro. The following utility will extract the current users for 4D Write/Write Pro:

// --------------------------------------------------------------------------------
// Name: GET_4D_WRITE_WP_USED_CNT
// Description: Method will get the current 4D Write/Write Pro users that are
// running on the server from the Get License info command.
//
// Output:
// $0 (LONGINT) - Return the number users currently using otherwise No users
// --------------------------------------------------------------------------------
C_LONGINT($0)
C_LONGINT($i)
C_OBJECT($licenseObj)
ARRAY OBJECT($productArrObj;0)

$licenseObj:=Get license info

OB GET ARRAY($licenseObj;"products";$productArrObj)

For ($i;1;Size of array($productArrObj))
  If (OB Get($productArrObj{$i};"name")="4D Write - 4D Write Pro")
    If (OB Is defined($productArrObj{$i};"usedCount"))
     $0:=OB Get($productArrObj{$i};"usedCount")
    Else
     $0:= -1
    End if
   $i:=Size of array($productArrObj)+1
  End if
End for


Note: This method will need to be executed on the server to get the current license information.

Here is an example of running the method:

C_LONGINT($numUsers)

$numUsers:=GET_4D_WRITE_WP_USED_CNT // e.g: 2 or -1 (No used licenses)


See Also: