QR Code Scan Creates Record Entry

Hey Community-

Does anyone know how to create a record entry by using a QR code scan? I’d like to design functionality to allow for security guards to scan a QR Code that will be at each location they have to to patrol rounds at and have the location, date, time, officer name logged.

This will result in a running log of all the locations they check during their shift. Also, if possible, I’d like the scan to create the record entry without allowing a form to be filled out/edited by the security officer (basically all behind the scenes so to speak).

Any suggestions would be appreciated!

Thanks!
Adam

1 Like

Hi Adam,
doing a lot of QR scans becomes frustrating,
consider using NFCs, they are much faster and it is enough to bring them close to the label without opening a scan app, write them with a link to a Tadabase form, where the guard only has to click the button that writes Date, time, position,

it could be an idea?

@DanioA, thank you for following up. Sounds like a good option however I have never worked with NFCs before.

Adam

@DanioA whats the easiest way to write to NFC?

It’s actually not as complex as some might expect. Works very similarly to QR codes.

Do you have some NFC cards/stickers you can use? I can write up a short guide on how to do this.

This will require an app to write to NFC (I’ve used NFC Tools for Android) and then rest is done via some basic Javascript.

@moe-

Great! Just got some NFC tags and downloaded NFC tools. Any guidance you can provide would be great!

~Adam

@SafetyUniversity, here you go…

I’m gonna assume what we’re trying to achieve here is the ability to scan a card/chip and have it submit a form. So in my case, I want the form to have 4 fields.

  1. Submitted By:
  2. Location (connection field)
  3. Date and Time

The submitted By will be a record rule of whoever is logged in. Date and time will also be a record rule to the current date and time. The Location will be the ID of the connection field.

So first let’s get the ID of the location and save that value as a basic text value to the NFC chip. You can do this with some simple code, but it’s just easier to do this with a native app like NFC Tools. Make sure you write it to the card as a text value.

So in my case I have 2 chips, one has the value of “4MXQJdrZ6v” and the other “DVWQWRNZ49”

Now the fun part, i have a form on a page without any fields, but with 3 rules. This is all we need to do on the form part:

The key, is that we’re setting the Location value to the Browser Local Storage value of ‘locationId’

Next, let’s add our Javascript, make sure to update the compoent id at the top to your ID:

TB.render('component_3', function(data) {
    
    const ndef = new NDEFReader();

    async function startScanning() {
       await ndef.scan();
       
         ndef.addEventListener("reading", ({ message, serialNumber }) => {
       
          const textDecoder = new TextDecoder(message.records[0].encoding);
          var cardValue = textDecoder.decode(message.records[0].data); 
         
          localStorage.setItem('locationId', cardValue);
          data.ele.find('.form-submit .af-form-submit').click();
        
        });
    }
    
    startScanning();
    
}); 

What we’re essentially doing is after the form is loaded, we enable the scanner, then when we get the scanned value, we save it to the browser local storage and submit the form. The rest happens in the form record rules.

One other minor change I made was to add a class to the form submit button of ‘hide’ so we don’t ever see it.

Here’s a rough demo:

3 Likes

Moe your post demonstrates your great availability and passion, as well as a great ability in programming. :grinning:

However I had thought of it, much simpler :hot_face:
On the Nfc write the link that refers to a form (to see which you must be logged in) save the form, without writing anything, the rules do everything, register the position, date, and username

For those interested in the subject, this is a site very rich in information, it is in Italian, but very informative about technology:

These are in English, more focused on developments and sectors of use:
https://members.nfcw.com/explore/
https://www.rfidjournal.com/tag/environment

To those who asked how to write an NFC, there are small devices costing a few dollars that allow fast reading and writing (used for large quantities)
But it can also be done with a normal phone equipped with an NFC reader

Pay attention that not all NFCs are the same, some once written, cannot be modified, others can be rewritten endless times, others can be protected by a password.

good job

Amazing work! Thanks @moe @DanioA for sharing this!

Hi Guys, building on a similar feature. I run a club where I would like to issue members with a card that is valid for 12months (annual membership to the club). Then, when they turn up to an event they just show their NFC card and it books them in.

So whilst it is similar to Moe’s demo above, I need the system to check the validity of the nfc read - i.e. is the membership still valid (in date) and either accept the entry or flag up the expiry.

1 Like