How do I create a QR code?
In this lesson we will use the LCQRCode function to create QR code and display it in a container field.
The LCQRCode function
The LCQRCode function takes 4 parameters
- Content - the content to be encoded in the QR code
- Error Correction Level - QR codes have the capacity to restore data if it is dirty or damaged. The value is one of
- L - Approx 7% (default if unspecified)
- M - Approx 15%
- Q - Approx 25%
- H - Approx 30%
- Size - an integer specifying the size of the QR code. The default in 3 if the value is not specified.
- Mask - a mask changes the bits according to their coordinates in the matirx. The purpose is to make the QR code easier for a scanner to read. The mask number is an integer between 0 and 7.
For more information on these values see
Solution Layout
In your solution create
- a field to specify the content to be encoded in the QR code
- a drop-down list to select the error correction level
- a field to specify the size of the QR code
- a drop-down list to select the mask value
- a container field to hold the QR code that is returned by LCQRCode
- a button to generate the QR code. In button setup name it and choose `Single Step` as its action.
![](https://media.screensteps.com/image_assets/assets/000/809/168/original/3963c627-2831-4820-b5a9-ded991f65656.png)
Create QR Code button script
The `Create QR Code` button script is just a single script step. It passes the values of 'content', 'errorCorrectionLevel', 'size' and 'mask' to the "LCQRCode" function and sets the QR code container to the result.
Testing
![](https://media.screensteps.com/image_assets/assets/000/809/171/original/4c9ad005-88e1-472a-a05c-0c381ec489ba.png)
Exit layout mode and set the values of 'content', 'errorCorrectionLevel', 'size' and 'mask'. Click the "Create QR Code" button and you will see a QR Code in the image container field.
Change some of the values and generate another QR Code, the image will change.
0 Comments
Add your comment