Product: LABELVIEW, CODESOFT
Version: All Versions
LABELVIEW and CODESOFT can pull information from a second database using a Table Lookup. The following describes how to add a Table Lookup variable:
1. From the Data Source drop-down, navigate to Table Lookup > Add. Alternatively, from the Data Sources window on the right side of the screen, right-click Table Lookup and select Add. This will launch the Table Lookup window.
2. Name your Table Lookup. For this example, we'll use Test.
3. Select an existing ODBC or OLE DB Data Source from the drop-down menu. For this example, we've selected the TEKLYNX sample database called Toys.
If the required data source is not shown in the list, the New button provides access to both the ODBC Data Source Administrator and the OLEDB Administration dialog box. To create a new connection for a Table Lookup, however, we recommend using the Wizard.
4. Select your Creation Mode. In most cases, you'll want to stick with Standard Creation Mode. If you'd like to modify the SQL Query, selecting SQL Mode will allow you to do so, and will give you access to the SQL Query Builder.
NOTE: We recommend not executing complex queries from within the software.
5. Select your Table and Result Field, which is the data that the Table Lookup will return. If you'd like the Table Lookup to return all the available fields from the database, do not make a selection.
Selecting a Table:
Selecting a Result Field:
6. Click the Append Now button to define your Key Field and Key Value (Data Source).
7. Select your Key Field and Key Value from the drop-down menus. Key Field is used to select the fields in the table where the search will be carried out, and the Key Value (data source) is used to select the current document variables containing the search value.
For example, you may have created a When Printed field called Lot Number. Ultimately, you'd like to input the Lot Number at print time and have it return the Part Number that's associated with that Lot Number. To accomplish this, you'd set the Result Field to PARTNUM, the Key Field to the name of the database field that contains the lot number (In this case, LOTNUM) and the Key Value to the When Printed field (Lot Number). The software will then take the Lot Number you enter at print time, search for a matching value in the LOTNUM column of your database, and return the part number associated with that record.
NOTE: The data source containing the search value must be created before creating the search data source that will use this value.
If several table records fulfill the condition, the first one encountered will be displayed.
8. Click Test to see your results.
If done correctly, you should query out your Result Field.