Jump to content


Photo
- - - - -

Variable In Query


  • Please log in to reply
5 replies to this topic

#1 Diederd

Diederd

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 30 September 2011 - 04:16 AM

Is it possible to make a query in Bartender with the value , which you selected in a listbox or combobox, instead of using a the query-prompt.
The reason is the contents of the fields are to long too enter it every time you need a label. So I thought to make a list- or combobox in the prompt-view. And with this selection I can select the database record.

Is this possible ?

#2 Shotaro I - Seagull Support

Shotaro I - Seagull Support

    Member

  • Moderators
  • 421 posts
  • LocationJapan

Posted 02 October 2011 - 06:48 PM

Hi Diederd,
Unfortunately current record selection in BarTender UI is only Text input box on query prompt, and/or record selection dialog.
Since that is reasonable and well wanted request, I'll add that to BarTender's feature request.

Often used solution is use BarTender Automation edition and create an application to filter value.
BarTender automation edition has command line option
/?"QueryPromptName"="QueryPromptValue"

So you can create any application to give command line or Commander script to print format with filtered value.
You can use this command line like this:
"C:\Program Files\Seagull\BarTender Suite\bartend.exe" /F="c:\format.btw" /P /?"QueryPrompt1"="0001" /X

or commander script trigger like this
%BTW% /AF="c:\format.btw" /P /?"QueryPrompt1"="0001"

Query prompt value can be specified from ActiveX, .NET SDK and BarTender XML Script too.

Another option is not using BarTender's database connection, manually create database connection via VBScript.
Use user prompt's dropdown box to select a condition by OnFillList VBScript (like this) then retrieve data by OnPostPrompt VBScript from database to fill label values.
This is a tedious approach so I don't recommend it.

#3 Diederd

Diederd

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 03 October 2011 - 11:38 PM

Dear,

Thanks for the quick answer.

I have solved it like you suggest below

Another option is not using BarTender's database connection, manually create database connection via VBScript.
Use user prompt's dropdown box to select a condition by OnFillList VBScript (like this) then retrieve data by OnPostPrompt VBScript from database to fill label values.

Because the total quantity of fields ,what must printed, was not much, it could be solved with this approach. But it would be nice if it was possible to manage this in query selection in the future.

#4 rickerman

rickerman

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 22 April 2014 - 02:33 AM

I am also really interesting in using a drop down list as a query value. This post is over 2 and a half years old, so it looks like this feature will not be implemented.

 

I am however interested in the VBScript solution, please can you elaborate how to get this working?

 

I have got the OnFillList VBScript working, and it correctly fills the drop down list. I then store the selected element in a named data source. I have also created a OnPostPrompt VBScript which queries my database with the value stored in the named data source. What I am really struggling to do is return multiple records from the VBScript.

 

Basically I have an eCommerce website that populates a database. Because multiple admin users can be using the website at the same time, each admin user has thier own profile. Stored in the database is the details of the labels that require printing, and the profile of the admin that created them. What I need is when they open bartender, they select thier profile name from a dropdown list, and then it will print all the labels associated with that profile.

 

Is there anyway to return a recordset (the same way it does when you create a database connection) from VBScript OnPostPrompt?



#5 rickerman

rickerman

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 23 April 2014 - 07:54 AM

I am also really interesting in using a drop down list as a query value. This post is over 2 and a half years old, so it looks like this feature will not be implemented.

 

I am however interested in the VBScript solution, please can you elaborate how to get this working?

 

I have got the OnFillList VBScript working, and it correctly fills the drop down list. I then store the selected element in a named data source. I have also created a OnPostPrompt VBScript which queries my database with the value stored in the named data source. What I am really struggling to do is return multiple records from the VBScript.

 

Basically I have an eCommerce website that populates a database. Because multiple admin users can be using the website at the same time, each admin user has thier own profile. Stored in the database is the details of the labels that require printing, and the profile of the admin that created them. What I need is when they open bartender, they select thier profile name from a dropdown list, and then it will print all the labels associated with that profile.

 

Is there anyway to return a recordset (the same way it does when you create a database connection) from VBScript OnPostPrompt?

 

I have made some slight progress on trying to fix my problem.

 

I decided to get all the data from the database, and then filter it at print time. This is proving very difficult but I cannot figure out why it is not working.

 

I have a dropdown list, populated by an sql query to my database. I store the result of the selected item in a named data source called "Profile".

 

The way I am filtering records to print or not is via a data source which controls how many copies of each record to print, ( File -> Print. Click the button to the right of copies). The data source is a VBScript, and below is the code I am using to show the problem. This code is in the OnNewRecord event

 

'Called for each new record read from the current database selected.

ReferenceSharedSubString("Profile") 
ReferenceField("profiles.id")

selected = Format.NamedSubStrings("Profile").Value
database = Field("profiles.id")


MsgBox("Selected: " + selected  + vbCr + "Database: " + database  )
If database = profile Then
	' print
	Value = "1"
Else
	' don't print
	Value = "0"
End If

 

The MsgBox is for debugging purposes. What happens for me is that on the first record, the "selected" variable is populated correctly, on every other record after the first it is blank and so my comparisons don't work.

 

Is anyone able to help with this problem? I would really like to buy bartender as everything else is working perfectly so far.



#6 Domingo R - Seagull Support

Domingo R - Seagull Support

    Support Technician

  • Moderators
  • 743 posts
  • LocationMadrid

Posted 23 May 2014 - 06:48 AM

Your best bet (when getting back multiple records for the query prompt), is to externally control BarTender via a third party application making use of the BarTender .NET SDKs. You would connect to the database, show the drop-down list selection, and save the query prompt result to a delimited text file (one line per record). You would then have BarTender connect to this delimited text file and print out the labels (one label per record will print).

 

BarTender .NET SDKs

http://www.bartender...ET(English).pdf






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users