Apply a Value for Your Barcode Conditionally

Top Previous Topic Next Topic  Print this topic

This example highlights the use of your data source to test and then apply a value to your barcode when a specific condition is met. In this scenario, we will want to set up a condition to test the data source for a specific region, then depending upon the results apply a value to the barcode.

 

Understanding Your Data

To begin, you will need to know exactly where in your data you have information to drive the generation of this barcode.

 

Using the Insert Barcode Dialog to Configure

 

1. From the Insert tab in the Ribbon select the Barcode button.

 

2. In the Insert Barcode Dialog, you will notice a Dynamic Values button. Upon selecting this button, you can configure a default value to be used. This default can be a static value you can type or you can select the Dynamic Value button to configure a default value to come from your data source.

 

3. To add a condition select the Add rule from the Dynamic Value Dialog.

 

barcode_condition

Figure 1: The Add new condition button is highlighted in the Dynamic Value Dialog.

 

4. In the Create Condition Dialog, you will now need to follow a few steps to configure.

 

a. Select in the Data Tree the data value to base your condition on.

 

b. Then, choose your type of condition based on available options for based on occurrence, numerical value, or text value.

 

c. Then specify the details of your condition for contains or starts with using the drop down menu available and then add the value to test for. You can create more complex conditions manually by selecting the Create Expression button. When you are finished configuring your condition, select Save.

 

 

barcode_condition3

Figure 2: A condition is configured in the Create Condition Dialog.

 

5. Select Insert and you will be returned to the Dynamic Value Dialog. You can now add a static value manually or you can select the Dynamic Value button to choose a value to be obtained from the data source when the condition is met. For our example, we want to apply the value '1234' when the region equals 'USA' so we will add this value dynamically.

 

barcode_condition4

Figure 3: The value is added for when the condition is met.

 

6. You should repeat this process to set up the conditions that you would like to have evaluated based upon your data source. Remember that when no condition evaluates to true, your default value will be used.

 

7. When you are satisfied with your condition setup, select Insert and the barcode will be inserted the barcode into your document template.

 

8. It is recommended you test the conditional application of your barcode value, by changing the fields in your data source. In our example, we will change the region attribute to test the outputs based upon our conditions.

 

barcode_condition_usa

Figure 4: The barcode value when condition is met for USA.

barcode_condition_can

Figure 5: The barcode value when condition fails and the default is used.