Multiple Columns Of Data, Excel File 关注

Legacy Poster

Good morning,

BT 10.0 SR1 Enterprise Automation
Servers are either Win 2008R2 or Win 7, 64-bit
Clients are a mix of Win XP and Win 7.

Very new to BT, and a search showed no obvious answers, but I may have missed it.

I am attempting to print multiple pieces of data onto a label. If I perform a DB connection setup and associate the desired fields, using the BT thick client, I get close to what I want. I can scroll through the records to get the appropriate label. Ugly, but workable. (I haven't found a workable way to use a drop down list or text entry field to select a product and have it populate the SKU.)

The real challenge is that we are wanting to use Web Print Console to have the operators get access, but the above method doesn't work at all with WP. You can see the first label only.

I do have a vbscript which allows me to create a drop down list, but that only populates one field of data, and I am not knowledgeable enough with vbscript to have it populate the second field based on the content of the drop down list.

My data source is an excel spreadsheet with two columns of data: product and SKU. When I select the 'product' from the drop down, I want the SKU to be printed for that product as well.

Here is the vbscript used to select the product:

''''''Dimension object variables
dim objConn
dim strConn
dim rs
dim path
dim sqlStr

''''''Get the path to the label (and excel file)
dim labelPath

''''''Set this value to nothing to start, otherwise Sample Text will be in our dropdown list
value = ""

''''''Excel Connection
strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & labelPath & "\label-data.xls;Extended Properties=Excel 8.0;"
Set objConn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
objConn.Open strConn

''''''SQL Select Statement

rs.Open sqlStr, objConn, adCmdText

''''''Go to the first record, read the cells until its reaches the end of the set
do while not rs.EOF
value = value & rs.fields("PRODUCT") & vbcr

''''''Close the connection
Set rs = Nothing

''''''Remove the carriage return from the end of the value
value = Left(Value, Len(Value)-1)

Thanks for any assist you might be able to provide.


1 评论

Ian Cummings
评论操作 固定链接

It sounds like you need to setup a query in the database setup dialog using a query prompt. The below training videos will step you through the process:

It should be noted that a query prompt only supports the text input form control at this time. If you need something like a combo-box, then you will need to create your own front-end application form with something like VB.NET and control BarTender for printing via the .NET or COM automation interface.