Pass Command Line Data To Print Follow

0

Hi,

I’m connecting my application with BarTender SW and I want
to pass a parameter from my application to the Bartender and print the label
pertaining to the passed parameter (record) without popping up ‘select records ‘window.
Therefore, how do I pass a parameter(specific record data) in the command line and
what would be the changes have to make for SQL statement in the database setup?

 

Your reply greatly appreciated.

3 comments

0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

You'd use the /?<queryPromptName> command line switch.  The default query prompt name would look like this: /?QueryPrompt1="ABC123"

 

*"ABC123" is an example criteria value you're passing to the query for the purposes of your print job.

0
Avatar
Legacy Poster
Comment actions Permalink

Is there any possibility to pass the whole sql statement(command line) to bartender ?  And bartender needs to set the input string as sql statement. Because my sql is a customized query.

0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

Yes, see the below example:

 

When using an OLE DB or ODBC database connection, custom SQL statements may be used to perform record filtering when data browsing or to select database records at print time. To apply custom SQL statements, use the SQLStatement property.
 
The following code demonstrates how to set a custom SQL statement when using an OLE DB database connection.
 
string SQL = "SELECT `Calories` FROM `NutritionInformation`"; 
Engine btEngine = new Engine();
LabelFormatDocument btFormat = btEngine.Documents.Open(@"C:\NutritionLabel.btw");
((OLEDB)btFormat.DatabaseConnections[0]).SQLStatement = SQL; 

Please sign in to leave a comment.