When sending data over a socket or in a web service integration, you have the option to send more than one record, much like a table structure with a file integration. This will allow you to send more information in one single trigger file.
When you create a new integration, it will only read and process one record. However, with some additional actions, you can direct the integration to process multiple records instead.
BarTender 2016 and above with Automation Edition and higher
It is possible to send data over TCP or via POST that already has a "table like" structure, like the example below:
In order to be able to use the contents of "flat" files as variables, two additional actions are needed first: "For Each Database Record" and "Transform Text To Record set":
These two actions can be used "regardless of the type of integration" as it will use them based on the values of the %EventData% variable, this is the variable that saves all the incoming data for the integration.
The Transform Text to Record Set action can only accept text-based databases like CSV, tab-delimited, or other similarly delimited databases. More complex text-based databases such as XML or JSON won't properly work.
Setting up the "Transform Text to Record Set" action
The first action that needs to be defined is the "Transform Text to record set" action (this action will transform the data as a database like structure):
- First you will need to have a "sample" file that will be used to define the structure of the incoming data. For example, use a sample document with the same structure that is then going to be used on the sent data via TCP or POST.
- Click the "Database Connection setup..." button then use the wizard to link the "sample" database file to the integration. Once you've connected the database, close the dialog.
- On the "Text Source" option make sure that the "Variable" is set to "%EventData%" and that the output is also "%EventData%".
This means that the data the action is going to use is the one on the variable "%EventData%" which is the one on which the integration is automatically going to save all the incoming data.
Setting up the "For Each Database Record" action
After the the data is split up into records, the integration will need to know how to handle these records coming in. The "For Each Database Record" with a "Print Document" action nested as its child will ensure that each record is printed individually during print time:
The "For Each Database Record" action requires no setup, however, you'll need to define how the data fits onto the label. This is done in the Print Document action.
- First, your label will need to have all the values set up with Named Data Sources.
- Click on the Import Document Settings button to import and fill in the Named Data Source names.
- Next, match the label's Named Data Source to the field names from the sample database. If you did not assign field names, they will be the auto-generated names of Field1, Field2, and so on.
- Select the variable icon in the Named Data Sources table to insert the name of the field from the dialog. The field names will be found under the Action section as shown below:
If you know the field names, you can type them in manually in the syntax %FIELDNAME%.