Knowledge Base
cancel
Showing results for 
Search instead for 
Did you mean: 

How to set the current area of ALL personnel objects in a folder using a PE program.

Issue

Site implements Entry/Egress anti passback access sequence and uses a program that runs overnight to 'forgive' all anti-pass back violations.

Environment

CyberStation

Cause

Documentation

Resolution

The following PE code is provided as a sample of how to have a PE program set the current area in ALL personnel objects.

NOTE:

The code is given for illustration ONLY and is not intended to be taken as a complete solution, partners using this sample code must be sufficiently proficient in Plain English so as to make the necessary changes and modifications to the code to adapt it to their particular application.                                      


 

'This WorkStation program sets the current area of ALL personnel objects found in 'theFolder' to "theArea"
'Program's flow type is LOOPING.

Number RESULT
Object thePerson, theArea, theFolder

Line INIT
'ENTER THE FULL PATH TO THE FOLDER THAT CONTAINS THE PERSONNEL OBJECTS
  theFolder = Root\CredentialHolders
'ENTER THE FULL PATH TO THE AREA
  theArea = Root\MyAreas\TestArea2
  Count = 0
'OPEN THE LIST OF PERSONNEL OBJECTS IN THE FOLDER
  RESULT = OpenList("Personnel", thePerson, theFolder)
  If RESULT = Success then Goto COUNT_THEM Else Goto CLOSE_LIST

'COUNT THE OBJECTS SO WE KNOW WHEN WE HAVE GONE THRU THE LIST EVEN IF WE ENCOUNTER AN ERROR
Line COUNT_THEM
  While GetObject(thePerson) is Success
    Count = Count + 1
  Endwhile
  CloseList(thePerson)
  Goto RE_OPEN
 
Line RE_OPEN
  RESULT = OpenList("Personnel", thePerson, theFolder)
  If RESULT = Success then Goto SET_AREA Else Goto CLOSE_LIST

Line SET_AREA
'GET THE NEXT PERSONNEL OBJECT IN THE LIST
 While GetObject(thePerson) is Success
'SET THE CURRENT AREA
  thePerson Value = theArea
  'thePerson Value = UnKnown   'to set all to UnKnown comment the line above and un-comment this line
  Count = Count - 1
 Endwhile

 Goto CLOSE_LIST
 
Line CLOSE_LIST
  CloseList(thePerson)
  Stop

Line E
  If Count > 0 then 'WE ARE NOT AT THEN END OF THE LIST, HERE PROBABLY DUE TO SOME ERROR SETTING THE AREA, SKIP THIS OBJECT AND GO TO THE NEXT
    Goto SET_AREA
  Else 'END OF LIST, WE ARE DONE
    CloseList(thePerson)
    Stop
  Endif

Tags (2)
Labels (1)
Version history
Revision #:
1 of 1
Last update:
‎2018-09-06 09:56 AM
Updated by: