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
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.
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.
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.