# generateQRCode

## Description

Creates an image for a type of matrix barcode (QR Code).

## Input / Parameter

| Name  | Description                                                                 | Input Type  | Default | Options | Required |
| ----- | --------------------------------------------------------------------------- | ----------- | ------- | ------- | -------- |
| type  | Not currently in use by the function.                                       | String/Text | -       | -       | No       |
| value | The value to be attached to the QR code.                                    | String/Text | -       | -       | Yes      |
| logo  | An image base64 or URL of an image to be appended to the QR Code.           | String/Text | -       | -       | No       |
| extra | The value to be included to the 'callback' as a system value under 'extra'. | Any         | -       | -       | No       |

## Output

N/A

## Callback

### callback

It is executed after the function completeled generating the matrix barcode (QR Code).

| Description                     | Output Type |
| ------------------------------- | ----------- |
| Returns the image base64 value. | String/Text |

## Video

Coming Soon.

## Example

### Steps

1. First we add 2 components to the page:

   1. A button to generate the QR code
   2. `imgQR`, an image placeholder for the QR code once generated.

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-e4647262230abc70d3272634471bffe1b0d1c3ac%2FgenerateQRCode-step-1.png?alt=media)
2. Select the "Generate QR Local" button and add these 2 functions to the event flow:

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-a18a7ce420bcb05291eade11904b2f2a68e2d0ee%2FgenerateQRCode-step-2.png?alt=media)
3. For `generateQRCode` function, the parameters are:

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-b0a64de60519356027603a3cb73b853421005b44%2FgenerateQRCode-step-3.png?alt=media)
4. For the `setComponentFunction`, we set the "component" value to "imgQR", the image placeholder created in step 1.

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-e3ec2ee916c5971c2a46c58425845eeadd15f2da%2FgenerateQRCode-step-4.png?alt=media)

   For 'value', we add a subflow with the function "objectAttr" like so:

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-b49b369d63e5039e50465415629c29b05c6a8acc%2FgenerateQRCode-step-5.png?alt=media)

### Result

![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-af177353b05e4bb11f29401f7fc1b088f156d787%2FgenerateQRCode-result-1.gif?alt=media)

## Links
