跳到主内容

搜索

搜索

Variable In Query

评论

5 条评论

  • Avatar
    Shotaro Ito
    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 [url="http://seagullscientific.invisionzone.com/index.php?/topic/201-vbscript-to-populate-a-dropdown-list/"]this[/url]) then retrieve data by OnPostPrompt VBScript from database to fill label values.
    This is a tedious approach so I don't recommend it.
    0
  • Avatar
    Legacy Poster
    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.
    0
  • Avatar
    Legacy Poster

    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?

    0
  • Avatar
    Legacy Poster

    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.

    0
  • Avatar
    Domingo Rodriguez
    版主

    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.bartenderbarcodesoftware.com/label-software/whitepapers/Controlling-Barcode-Label-Software-using-C-Sharp-and-VB.NET(English).pdf

    0

请先登录再写评论。