Multiple Columns Of Data, Excel File Follow

0
Avatar
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
labelPath=Format.Directory

''''''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
sqlStr = "SELECT PRODUCT FROM [TABLE_NAME$]"

''''''Execute
rs.Open sqlStr, objConn, adCmdText

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

''''''Close the connection
rs.Close
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.

m

1 comments

0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

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:

http://www.seagullscientific.com/aspx/training-video-(reading-data-from-database).aspx

http://www.seagullscientific.com/aspx/training-video-(selecting-records-from-a-database-at-print-time).aspx

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.

http://s3.amazonaws.com/SeagullBarTender/ftp/WhitePapers/WhitePaper_BarTenders.NET_SDKs_English.pdf

http://s3.amazonaws.com/SeagullBarTender/ftp/WhitePapers/WhitePaper_BarTendersActiveXAutomationInterface.pdf

Please sign in to leave a comment.