hexagon logo

Badge Scan for Employee

Hello All,

Is there any line of code i can enter to make PC-DMIS search for an ID number inside an excel file or something? The reason i ask is we have been having unauthorized users using the CMM without training and we want to be able to hold them accountable. We would also like for that same transaction to be able to place there info into the report as well in case they are using someone else badge because they don't have training to hold them both accountable.

Parents
  • You can start requiring a badge number at the start of your programs, and in the background hardcode the numbers to the corresponding employees. That way there is only a set of valid inputs allowed. Then you can send it to a text file or the report file if you save them after each run. Only downside will be that like you said, other people can use their badge or simply just write the number down. You could also generate your own internal system of "badge numbers" or essentially access codes/passwords give them out to the employees.

  • yes thats true, we were hoping for an excel option or somthing along those lines since the people who are using it are running like 10 different programs and we didnt want to have to edit all of them, but instead as they get trained add them to an excel sheet that it can trace back or whatever.

Reply Children
  • You could certainly do this with an excel option. What is your current reporting method? The built in pc-dmis one? Or a custom one?

    You could have an extra command at the end that adds their badge number + name, and part ran in a separate excel file

  • START      =LABEL/
    C1         =COMMENT/INPUT,NO,FULL SCREEN=NO,
                Enter Badge Number
                IF/C1.INPUT == "1234567"
                  ASSIGN/NAME="JOHN SMITH"
                  GOTO/NEXT
                END_IF/
                IF/C1.INPUT == "7654321"
                  ASSIGN/NAME="JANE SMITH"
                  GOTO/NEXT
                END_IF/
                COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,OVC=NO,
                Invalid Badge Number
                GOTO/START
    NEXT       =LABEL/
                ASSIGN/PART=GETPROGRAMINFO("PARTNAME")
                ASSIGN/DATE=SYSTEMDATE("dd/MM/yy")
                ASSIGN/TIME=SYSTEMTIME("HH:mm:ss")
                ASSIGN/FILEPATH="C:\CMM\\"+PART+"_TESTFILE"+".CSV"
    VERIFY      =FILE/EXISTS,FILEPATH
                IF/VERIFY == 0
                  ASSIGN/HEADERS="Date,Time,Part,Name,Badge"
    FPTR         =FILE/OPEN,FILEPATH,WRITE
                  FILE/WRITELINE,FPTR,HEADERS
                  FILE/CLOSE,FPTR,KEEP
                END_IF/
    FPTR       =FILE/OPEN,FILEPATH,APPEND
                ASSIGN/DATALINE=DATE+","+TIME+","+PART+","+NAME+","+C1.INPUT+"
                FILE/WRITELINE,FPTR,DATALINE
                FILE/CLOSE,FPTR,KEEP

    Try this out, change your names, badge numbers, file path, and any other input values as needed. I tested it and this is the result. This is currently saving to its own excel file in a location separate from the program results. 

    You can put this at the end of any of your programs and it should not interfere. You can also put it at the beginning instead if you want to know right away if someone who should not be running the program is running it.

    As  just reminded me, you can use IF/GOTO instead of IF, then adding a GOTO command.

                IF_GOTO/C1.INPUT == "1234567",GOTO = NEXT
                ASSIGN/NAME="JOHN SMITH"

    Looking back at this, I am not sure it will work the same way I have it above, I don't use IF GOTO enough. I do not know if the variable will assign before the actual GOTO. I imagine it will not due to the order of commands. So use my example above, and ignore this portion.

  • i think you would need the "if goto" right before the "next" label and loop it back to the "C1 comment"  if "C1.input==0" or some other unassigned variable for badge number(s). 

  • Yeah, that sounds right. I modified mine above so that if none of the inputs are the 2 badge numbers I set above, it says the number is invalid, and starts you over back at the input comment

  • this is pretty slick  , but I would advise to not use syntax for any identifier, that's an active function (CHECK is an active command controlling probe search distance). 

    You could hide the details in a collapsed group (or even a subroutine) so laypersons can't see the code.

    I wonder if we can do an Excel vlookup function.  Have a user input reference an excel list of "approved" employees and it checks if the name (via vlookup) is listed. if not, have a kill command to goto an endpgm lablel.

  • Good catch,  I threw this together quickly throwing in variable names without thinking about the check command for probing. I changed it to the variable name "verify" instead. I do have this running through the if statements, so that if you enter anything but the 2 "users I created you have to start from the top again with a valid badge number. And yes if I were to use this for anything I would definitely hide it in a group. You can most certainly throw in a Vlookup into a basic script. Not sure how slick you could get with PC-DMIS arrays.