Printing Multiple Rows From Database Result On A Single Label Page S’abonner

0
Avatar
Legacy Poster

Hi

 

I am creating a label and want to print multiple rows on a single label page from my database query result. My database query can give upto 6 rows in the result. Can I print them all on a single label page?  Currently when I am trying to print them, I get the first row on all the fields on the page and the same label page repeat multiple times.

6 commentaires

0
Avatar
Ian Cummings
Modérateur
Actions pour les commentaires Permalien

Currently BarTender is only able to print a maximum of a single record of data per label using BarTender's built-in database connectivity.  The question has been asked many times before in the forum, so feel free to search for information on the various workarounds possible.

1
Avatar
Legacy Poster
Actions pour les commentaires Permalien

Thanks for your reply. I looked for alternatives and found a VB script would work. It is as below:

 

 

dim sServer, sConn, oConn,oRS
sServer="aSQLServerDB"
sConn="provider=sqloledb;data source=" & sServer & ";initial catalog= Dev"
Set oConn = CreateObject("ADODB.Connection")
oConn.Open sConn, "aUsername", "aPasword"
Set rstComponents =CreateObject("ADODB.Recordset")

 

sSQL =  "SELECT ComSerialNum"
sSQL = sSQL & ", COALESCE (CustRevisionICS, ComRevision, '') as Revision "
sSQL = sSQL & ", ComponentType"
sSQL = sSQL & ", COALESCE (CustComPartNum, ComPartNum) as PartNum"
sSQL = sSQL & ", ComponentDescription "
sSQL = sSQL &  " FROM sp.vwLabelComponentDetail where CabSerialNum = '" & Field("vwLabelCabinetView.CabSerialNum")  & "'"
sQQL = sSql & "Order by ComponentType asc"
Set rstComponents = oConn.execute(sSQL)

 

PartText1=""
PartCode1=""
SerialNum1=""
Rev1 = ""
...
PartText6=""
PartCode6=""
SerialNum6=""
Rev6 = ""

 

dim i
i= 1
Do until rstComponents.EOF
 Select Case i
  Case 1
   PartText1 = rstComponents("ComponentType")
   PartCode1 = rstComponents("PartNum")
   SerialNum1  =rstComponents("ComSerialNum")
   Rev1 = rstComponents("Revision")
   
  Case 2-5 ...

 

  Case 6
   PartText6 = rstComponents("ComponentType")
   PartCode6 = rstComponents("PartNum")
   SerialNum6  =rstComponents("ComSerialNum")
   Rev6 = rstComponents("Revision")
  Case else
 End Select
 i = i+1
 rstComponents.MoveNext
Loop

 

oConn.close

 

However, I am not sure where to put this VB script in and how to map it to multiple columns on my label.

Also, I have an oracle database whereas this script connects to sql server. can you suggest what parameters go in for connecting to an oracle DB?

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

Has there been any new developments on this topic since 2014? I am having the same problem as the person who started this thread.

1
Avatar
Ian Cummings
Modérateur
Actions pour les commentaires Permalien

JBlanchard: Yes, enable the Page Template in the BarTender Page Set-up dialog, set the page size to be that of your overall label, and the label dimension to be the size of an individual line item.  In this case you'd have one column of six rows of labels on the page.  Set the margins appropriately to help define the main part of the label from the line item region.  The attached document should help you get started with the idea here.

0
Avatar
Jason Stone
Actions pour les commentaires Permalien

I am trying to do this exact same thing.  I have 6 Serial #'s and MAC addresses I want to print on one label based off of query results from a dbase.  Can you send me  a copy of the attached document you mentioned?

0
Avatar
Ian Cummings
Modérateur
Actions pour les commentaires Permalien

Jason: I guess the example via the following link should help you out: https://goo.gl/CcKAQi 

Vous devez vous connecter pour laisser un commentaire.