Xbasic

printQRCode Function

Syntax

qrcode as P = printQRCode (value as C [, sizeInPixels as N [, flagURLEncodeValue as L [, flagUseGoogle as L]]])

Arguments

valueCharacter

The value to encode in the QR Code image.

sizeInPixelsNumeric

Optional. Default is 200

The size of the QR Code, in pixels.

flagURLEncodeValueLogical

Optional. Default is .t.

Defines whether or not the value should be url encoded.

flagUseGoogleLogical

Default is .f.. Defines if the Google API (.t.) or internal (.f.) method should be used to generate the QR Code. If the internal method is used, the sizeInPixels and flagURLEncodeValue parameters are ignored.

An internet connection is required if the Google API is used to generate the QR Code.

Returns

qrcodePointer

Returns a mime object containing the generated QR Code. See *mime_object() for more information.

Description

Generates a QR Code from a character value.

Discussion

To print a QR Code in a report, define a calculated field using the printQRCode() function. The calculated field can then be placed in the report.

The printQRCode() function takes three arguments - the value to encode, the size of the QR code (in pixels) and a flag that indicates if the value should be url encoded (set to .t. by default).

The QR Code function calls into the Google charts api, so an Internet connection is required.

For example, here is how you can define the calculated field to print the 'serialnumber' field:

qrcode = printQRCode(serialnumber,400)

QR Code Generation

The QR Code can be generated using the Google API or Alpha Anywhere's built-in QR Code generation algorithm. Generating the QR code internally is substantially faster than using the Google API. The speed difference will be most noticeable in reports that call the printQRCode() function many times.

Limitations

Web Applications Only

See Also