Printing single database record for each record detected Follow



I have a connection to an MS-SQL database. In my integration job, I set it to delete the database records after printing them.

If I am printing 5 database records i.e, I dont want it to print all 5 records for each database record that is being detected. I would like each database record to print individually.

I would like to print the specific database record, for each database record that is being input. How can that be done?



Xabier Clemente
Comment actions Permalink

Hi Noam,

Apologies for the late response.

When using database integrations, and wanting to select records, you have basically two options:

  • You can use the detected information/record ("Integration input data", stored in the %EventData% variable) to substitute the database in your document.
  • You can instead have the document connected to the same SQL database as the integration, and pass a "query" value to the document so it locates the same records that were detected in the integration (using one of the field values from the detected record).

To solve your issue you first need to decide which of the above options you'd prefer to use (my suggestion would be the first, as it would avoid having to connect to your SQL database twice; but both are perfectly viable), and then do the following:

  • If you wish to choose the first option you'll need to modify the BarTender document so it uses a text file database connection with the same structure as your SQL database. For the integration to substitute the document's database it needs to be using a text file database, it won't be able to do it with any other database connection (which is why your current setup is not working).

  • If you wish to choose the second option you'll need to follow these steps:

  1. Create a query prompt in the document's database connection (let's call it "myQuery" as an example).

  2. Assign a value to that query prompt in the integration using the same field from the SQL database as the one used on your document for the query.

  3. Remove the "Database Overrides" option.

This way the document will effectively locate the same records that triggered the integration and print its data.

Please let us know how you get on and if you have any further questions; and again, apologies for the delay.

Please sign in to leave a comment.