Product: LABELVIEW, CODESOFT
Version: All Versions
The Table Lookup feature allows LABELVIEW and CODESOFT to retrieve information from an external database that is different from the database currently merged with the label. A Table Lookup searches the external data source using a matching value (Key Field and Key Value) and returns the information from a selected result field.
In this example, a Serial Number entered at print time is used to look up and return a corresponding Color value from an external database.
Before You Begin
Before creating a Table Lookup variable, ensure the following requirements are met:
- An external database is available.
- The appropriate ODBC driver is installed if required.
- A connection to the external data source has been created.
- A When Printed variable exists that will be used as the lookup value.
NOTE: Table Lookup variables are grouped beneath the table name in the Data Sources window. If multiple variables use the same external table, additional Table Lookup variables can be created by right-clicking the existing table name.
Create a Table Lookup Variable
The When Printed variable should correspond to the field used for matching records in the external database. In this example, the When Printed variable is Serial Number.
NOTE: Instructions for creating a When Printed variable are available here.
For this example, name the Table Lookup variable Color because it will return the Color value associated with the Serial Number entered at print time.
NOTE: Instructions for connecting to an external data source are available here.
- Click the Append row button to create a new Key field.
- Under the Key field column, select the reference field from the external data source.
- This is the field that the lookup will search against.
This is the value that the Key value will be compared to. In this example, the database column is Serial.
- Under the Key value (data source) column, select the variable whose value will be compared against the value in the external database.
Think of this as selecting the When Printed variable that will be used to perform the lookup. In this example, the variable is Serial Number.
- Click Test in the lower-right corner of the Table Lookup window.
- This verifies that the lookup returns the expected value.
- A dialog box displays the lookup result.
- Close the dialog after reviewing the returned value.
- If the test results are incorrect, review the configuration and make any necessary changes.
- Repeat the test until the expected value is returned.
- When the Table Lookup is configured correctly, click OK.
- After saving, the table name appears under Table lookup in the Data Sources window.
- In the Data Sources window, select the Table Lookup variable (for example, Sheet1$: Color).
- Right-click the variable and select Place.
- Click the desired location on the label.
- Select how the variable should be displayed:
- Text
- Barcode
- Image
- The Table Lookup variable now displays the value returned from the external data source.
- Each time a different Serial Number is entered into the When Printed variable, the Table Lookup returns the corresponding value (such as Color) from the external table.
