> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flowforma.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate barcode/QR

> Use the Generate barcode/QR business rule to create UPC, EAN, or QR code images from a form question and display or embed them in documents.

The Generate barcode/QR business rule allows you to generate a barcode or QR image from a question in a **FlowForma** form.

<img src="https://mintcdn.com/flowforma/29tXFCtk1ynp2c5R/images/product/creating-flows/business-rules/business-rule-types/communications-rules/generate-barcode-qr/generate-barcode-qr-1.png?fit=max&auto=format&n=29tXFCtk1ynp2c5R&q=85&s=11d4e00300c4d47623b2566b06e1e87b" alt="Generate barcode/QR rule configuration" width="613" height="824" data-path="images/product/creating-flows/business-rules/business-rule-types/communications-rules/generate-barcode-qr/generate-barcode-qr-1.png" />

## Title

The first part of the business rule lets you define a **title** for your rule and select the event on which it operates. The default title is the standard **FlowForma** rule name; change it by deleting the text and entering your own.

In the **event** field you determine when the rule is executed. For a flow this can occur when the form is loaded, started, or completed. For a step this can occur when the step is started, saved, or completed. For questions it can occur when the question is updated.

## Rule condition(s)

The second part of the business rule lets you set conditions. These are not required, but if entered they control when the rule is executed in relation to other items in the form.

## Rule actions

* **Source question:** this is the question in the process that will be used to generate the barcode/QR.
  * Source questions can be of the following types:
    * Single line of text
    * Multiple lines of text
    * Lookup
    * Choice
    * Calculated
    * Number
* **Barcode type:** a drop-down list containing the types of barcode that you want to create.
  * The barcode types available are:
    * UPC-a
    * UPC-e
    * EAN-8
    * EAN-13
    * QR
* **SharePoint destination folder:** choose where the barcode image file is saved. Select **Folder server relative url** to pick a folder directly (click **Select folder**), or **Folder url defined in a question** to point at a question that holds the folder URL.
  * When using a folder path, you can include these text tokens to change the path each time the rule runs: `{FormID}`, `{StepID}`, `{FlowTitle}`, `{StepTitle}`, `{FormTitle}`, `{FlowFormaUrl}`, `{FlowFormaParentUrl}`, `{FlowFormaSiteCollectionRoot}`. Tokens only apply when the folder is on the FlowForma site.
* **Output barcode to file upload question:** to view the barcode/QR on screen, select a file upload question contained in the process. This drop-down list displays the file upload questions contained in the process.
* **Output barcode value to question:** the final digit of a barcode is generally a check digit.

When entering a value in the source question you can enter either:

1. The full barcode value with the correct check digit (final digit), **or**
2. The barcode without a check digit (final digit). In this case, the correct check digit will be added and the barcode created.

The value of the complete barcode will be displayed in the question you select here.

* **Output error message to question:** if an incorrect barcode value is entered, a barcode will not be generated. Add this question to your process to inform you that the barcode entered is not valid.

- **Stop execution**: if stop execution is enabled and this rule is executed, no other rules are executed.
- **Enabled**: rules aren't saved to a list like questions and steps are, so if you want to stop a rule executing without deleting it, toggle this option to enable or disable the rule.
- **Enable audit**: if checked, a record is added to the audit trail when this rule is executed. This option is available when the Compliance feature pack is activated.

## Displaying the barcode

To display a barcode on the screen or include it in a document, you need to select a file upload question from your process.

<img src="https://mintcdn.com/flowforma/29tXFCtk1ynp2c5R/images/product/creating-flows/business-rules/business-rule-types/communications-rules/generate-barcode-qr/generate-barcode-qr-2.png?fit=max&auto=format&n=29tXFCtk1ynp2c5R&q=85&s=2fb5940f33f22447b10a69f331aa4b67" alt="File upload question settings for displaying a barcode" width="748" height="1000" data-path="images/product/creating-flows/business-rules/business-rule-types/communications-rules/generate-barcode-qr/generate-barcode-qr-2.png" />

### Display image on screen

To display the barcode/QR on screen, check the **Show image preview** checkbox (1).

If you only want to display the barcode, you can:

1. Hide the **Delete** and **Replace** buttons that are normally displayed when a file upload question is used, by checking the **Hide buttons** checkbox (3).
2. Hide the link to where the image is saved by checking the **Hide file link** checkbox (4).

### Include barcode/QR in a FlowForma document generator document

To display the barcode/QR in a document generation document, check the **Generate in document as image** checkbox (2).

## Form operation

### Barcode type UPC-a

<img src="https://mintcdn.com/flowforma/29tXFCtk1ynp2c5R/images/product/creating-flows/business-rules/business-rule-types/communications-rules/generate-barcode-qr/generate-barcode-qr-3.png?fit=max&auto=format&n=29tXFCtk1ynp2c5R&q=85&s=e3b1ac24c4bfc5073661280beb75ea70" alt="UPC-a barcode generated on a form" width="1007" height="897" data-path="images/product/creating-flows/business-rules/business-rule-types/communications-rules/generate-barcode-qr/generate-barcode-qr-3.png" />

Barcode type **UPC-a** is twelve numeric characters long, with the final character being a check digit.

You can enter either:

* Eleven characters. A barcode will be created by adding the correct check digit, and the full twelve-digit barcode value will be output to a question if selected in the rule.
* Twelve characters. This must be a valid **UPC-a** code. This twelve-digit barcode will be output to a question if selected in the rule.

If the barcode input is not valid, a message **Invalid barcode input** will be displayed in a question if selected in the rule.

### Barcode type UPC-e

<img src="https://mintcdn.com/flowforma/29tXFCtk1ynp2c5R/images/product/creating-flows/business-rules/business-rule-types/communications-rules/generate-barcode-qr/generate-barcode-qr-4.png?fit=max&auto=format&n=29tXFCtk1ynp2c5R&q=85&s=8db1e3513dd2c460b6e1b1524fd726dc" alt="UPC-e barcode generated on a form" width="1013" height="903" data-path="images/product/creating-flows/business-rules/business-rule-types/communications-rules/generate-barcode-qr/generate-barcode-qr-4.png" />

Barcode type **UPC-e** is eight numeric characters long:

* the first character is a type identifier and is either 1 or 2
* the final character is a check digit

You can enter either:

* Six characters. A barcode will be created by adding the type identifier to the beginning of the code and the correct check digit at the end, and the full eight-digit barcode value will be output to a question if selected in the rule.
* Eight characters. This must be a valid **UPC-e** code. This eight-digit barcode will be output to a question if selected in the rule.

If the barcode input is not valid, a message **Invalid barcode input** will be displayed in a question if selected in the rule.

### Barcode type EAN-8

<img src="https://mintcdn.com/flowforma/29tXFCtk1ynp2c5R/images/product/creating-flows/business-rules/business-rule-types/communications-rules/generate-barcode-qr/generate-barcode-qr-5.png?fit=max&auto=format&n=29tXFCtk1ynp2c5R&q=85&s=118bea6423b56b1b91912df382ee7eb0" alt="EAN-8 barcode generated on a form" width="1008" height="897" data-path="images/product/creating-flows/business-rules/business-rule-types/communications-rules/generate-barcode-qr/generate-barcode-qr-5.png" />

Barcode type **EAN-8** is eight numeric characters long, with the final character being a check digit.

You can enter either:

* Seven characters. A barcode will be created by adding the correct check digit, and the full eight-digit barcode value will be output to a question if selected in the rule.
* Eight characters. This must be a valid **EAN-8** code. This eight-digit barcode will be output to a question if selected in the rule.

If the barcode input is not valid, a message **Invalid barcode input** will be displayed in a question if selected in the rule.

### Barcode type EAN-13

<img src="https://mintcdn.com/flowforma/29tXFCtk1ynp2c5R/images/product/creating-flows/business-rules/business-rule-types/communications-rules/generate-barcode-qr/generate-barcode-qr-6.png?fit=max&auto=format&n=29tXFCtk1ynp2c5R&q=85&s=f0d817abdf6f7e83d9fe379634da3953" alt="EAN-13 barcode generated on a form" width="1006" height="899" data-path="images/product/creating-flows/business-rules/business-rule-types/communications-rules/generate-barcode-qr/generate-barcode-qr-6.png" />

Barcode type **EAN-13** is thirteen numeric characters long, with the final character being a check digit.

You can enter either:

* Twelve characters. A barcode will be created by adding the correct check digit, and the full thirteen-digit barcode value will be output to a question if selected in the rule.
* Thirteen characters. This must be a valid **EAN-13** code. This thirteen-digit barcode will be output to a question if selected in the rule.

If the barcode input is not valid, a message **Invalid barcode input** will be displayed in a question if selected in the rule.

## QR code

A **QR code** can be generated from any text input.

The input and output values will always be the same, and you should not encounter any errors.

<img src="https://mintcdn.com/flowforma/29tXFCtk1ynp2c5R/images/product/creating-flows/business-rules/business-rule-types/communications-rules/generate-barcode-qr/generate-barcode-qr-7.png?fit=max&auto=format&n=29tXFCtk1ynp2c5R&q=85&s=afbbc9bd8f2887ee8f99c29df4a8223a" alt="QR code generated on a form" width="1038" height="593" data-path="images/product/creating-flows/business-rules/business-rule-types/communications-rules/generate-barcode-qr/generate-barcode-qr-7.png" />

## Barcodes and repeating tables

You can use repeating table sub questions to generate barcodes in a repeating table, by attaching the rule to a repeating table sub question.

<img src="https://mintcdn.com/flowforma/29tXFCtk1ynp2c5R/images/product/creating-flows/business-rules/business-rule-types/communications-rules/generate-barcode-qr/generate-barcode-qr-8.png?fit=max&auto=format&n=29tXFCtk1ynp2c5R&q=85&s=971e574323e4c4e342c55fe3cb8cd958" alt="Barcodes generated within a repeating table" width="1045" height="842" data-path="images/product/creating-flows/business-rules/business-rule-types/communications-rules/generate-barcode-qr/generate-barcode-qr-8.png" />

## Barcodes in documents

By using the file upload question, you can include the barcode in a document using the **FlowForma** document generation tool.

<img src="https://mintcdn.com/flowforma/29tXFCtk1ynp2c5R/images/product/creating-flows/business-rules/business-rule-types/communications-rules/generate-barcode-qr/generate-barcode-qr-9.png?fit=max&auto=format&n=29tXFCtk1ynp2c5R&q=85&s=3f04846d8c75b596aa4bccb50472452f" alt="Barcode included in a generated document" width="1235" height="1019" data-path="images/product/creating-flows/business-rules/business-rule-types/communications-rules/generate-barcode-qr/generate-barcode-qr-9.png" />
