04. Training – Part 1 [11:56]

Description: This video explains the following:

  1. How to initialize (required once per FileMaker session).
  2. How to enroll a user.
  3. How to delete a single user or all users.
  4. How to view fingerprints, get fingerprint indexes and verify a user.

Transcript:

Let’s take a closer look under the hood of the Biometric Fingerprint Reader demo.

0:12 In Script Maker we have a variety of scripts. In the first series of scripts are general scripts to perform upon Open, Close, Close Window scripts, Unlock and Center Current Window script. These are really not important to the plug-in functionality per say, rather for the navigation and usage of the demo file itself. Then in this section we have Global Demo Buttons. These are scripts that are performed when things like the Doc Library button is clicked and the Product forum button and so forth; again, not so much for functionality of the plug-in itself, but more for the demo. And here we have the Registration Related scripts; this Register Plug-in will be triggered from this button here and a Plug-in Checker scrip, let’s go take a look at that one. This one is a script that determines if the plug-in is installed and if so, what operating mode the plug-in is in; is it registered, is it in Demo Mode or expired. This script is performed at the beginning of all these other scripts to determine if the plug-in is installed, is it registered and so forth. So let’s close that for a second. This script here will initialize the libraries that come with the plug-in and get FileMaker in a position where it can talk to the Biometric Reader. So let’s take a look at the Initialization script. We do some preliminary housekeeping: Allow User Abort [Off], Set Error Capture [On], here you can see we are performing the Plug-in Checker scrip; so by the time we get to here, we’ve determined that the plug-in is installed and running and then we can call our first function. In this case, it’s the function called PCFP which stands for Productive Computing Fingerprint; Initialize is the function and (500) says that we are going to initialize this with up to 500 fingerprints. The reason why we use zeros (0) not equals (=), is that this function, if successful, will return a 0 (zero). So in one motion we are calling the function and also determining if that function is returning an error code. So, if this function is unsuccessful it will return an error and perform this part of the script which will invoke a dialog here and tell the user what that error is by calling this command PCFP_GetLastError and with the parameter (Text), which means it will spell out the error in English words. If it is successful, it will simply bring up “Initialization Succeeded” dialog ready to use. So you’ll see this over and over again when we call our functions. We’re actually calling a lot of our functions in an if statement and killing two birds with one stone. We call the function at the same time determining if that function is returning an error or not. So that’s the initialize function. That is required once per FileMaker session.

3:12 Now let’s take a look at the Enroll functions. This function here; this script is called Enroll a User, and we will locate that here. The official name of the script is called “Enroll A User and Import That User’s Fingerprints”; because after we enroll the user into the device, we then pull back the fingerprint indexes for that user. So let’s take a look from the top here; were doing again that preliminary housekeeping; Allow User Abort [Off], Set Error Capture [On], then we perform the plug-in checker (again which just checks to see if the plug-in is installed and registered properly), then we begin prompting for a user ID. We’re storing the user ID that you saw on the demo in the previous video in a global field; and we use that global field here in this dialog box. You can see here we’re calling it User ID and we’re using that global field. So that just gives us an empty place holder for the user to put in an ID and a dialog. Now in your own scripts, you don’t necessarily want to call a dialog box and give the user a choice on what the user ID is. You really either want to call from a unique first and last name combination or a record ID or something unique that will properly identify a user. The reason we call this dialog is simply for the purposes of demonstration.

4:35 Ok, then we begin the validation of that user ID. There are some strict validation options and requirements that we need to be aware of. So the first thing we’re looking for is it must have a value; certainly can’t enter a blank ID. So it must not be empty, we’re checking that here in this part of the script. Then we’re checking that the data is alpha numeric (spaces are ok, but High-ASCII characters, other than alpha numeric are not allowed); so we validate that there. Then we validate that the length is not greater than 32 characters. And once it passes that, then we actually call the Enroll function, and here you can see that we’re actually using a variable and the function is PCFP_EnrollUser; and we’re simply saying this is the ID that I’d like to enroll.  This ID is representative of a person or individual, not their finger; and we’re storing that in a variable called DF. Then we say is DF not equal to zero; meaning did that succeed or fail. If it failed, we throw up a dialog and then explain what the error is and clear the user ID for another pass at it. We’re calling this function PCFP_DeleteUser in the event that one or more fingers were already entered into a previous enrollment. By deleting the user here we prevent a user from being created, because if you enroll a user twice and their finger is already enrolled, you’ll want to delete the one you’re working on. This would only happen if you allow your users to enter the same user twice; which is already not a good practice. We do this here for demonstration purposes because the typical developer will use their own fingers multiple times, so it’s very likely that you’ll run into a scenario where you’re going to register, in my case, my fingers several times while I test this plug-in. So this really would not be used in your solution ultimately.

7:00 Ok, the user is enrolled into the device and we’re now going to capture back the enrolled finger indexes. So that’s where we begin this process; we get the fingers for user and we supply it with the ID. Now that they’re enrolled, we’d like to get those fingerprints back. Again, if we have an error we call this function and show the error and clear the field. And in this step, we receive a space separated list of those fingerprint indexes and then we can parse those and create records from them; so that we can have in FileMaker the container data which is representative of the digital fingerprint along with the index number and of course the user ID. All of this logic here is: we’re creating a new window; we’re going to the layout where the users are and we’re actually creating a new user now as a record in FileMaker because it’s been enrolled properly; now we have to record it in FileMaker that it’s been enrolled. We create the user and then we go immediately to create the fingerprints for that user and that’s what this logic does here; we go to the layout where the fingerprints are stored and we some standard FileMaker logic where we create new records, set those records with fingerprint user ID and the fingerprint index which we’ve parsed. And you can see we’re parsing it using this logic here; get the value of the fingerprint list and we’re using a variable that increments by 1 each time to get that and you can see the increment down here. Another important thing to note that we’re getting is we’re importing the user by putting in the user ID and the fingerprint index; so this function here actually imports and stores the fingerprint digital  data in a container field in FileMaker, and we’re calling that container field “fingerprint” in the Fingerprints table. After we’ve gone through all the fingerprints, we close the window, commit the record, refresh it and that’s what you see here: you’ll have the user record here and the user’s associated fingerprints here. A quick look under the hood at the relationships and you’ll see that Main is my main interface file, Users is this portal here and there related fingerprints simply relating by the ID that we’ve captured on that dialog when we first enrolled. Ok, so that’s Enroll a User.

9:58 This “View Fingerprints” simply changes the ID and displays the fingerprints for that person, this button does that as well; and you can see this is Marc 2 with their fingerprints. This function called “Get Finger Indexes” will simply display in the dialog the enrolled fingerprint indexes for that user; and we displayed in the dialog for demonstration purposes. You may never need to display this to a user, it might be something you just want to have on hand as a handy function to say if I have this user show me the fingers enrolled; it might be a verification technique. So here we’re just showing this is the dialog here, the command to actually pull it, is right here. PCFP_GetFingersForUser and we simply give it a user ID and it gives me the indexes. We learned in another video that here we’re showing a handy picture of the finger indexes and how they layout on the hands, so that’s that. Delete User is pretty straight forward as well. This is done in a single command; which is PCFP_DeleteUser. Give the user ID and it will go to the device, delete the user and all related fingerprints for that user in one motion. Delete All Users is pretty straight forward as well; essentially the same thing except it deletes all the users. There are no functions parameter calls on this, it’s just delete all users and every user in the current session will be deleted.