Vb Scripting And Sql Data Follow

0
Avatar
Legacy Poster

Bartender V10 SR $ moving to 10.1 in a few weeks if that makes a difference.

 

I have very little experience with VB scripting … in fact I have only created two labels using VB scrip transform and they used simple If …else statements to determine the value of a field.
 

What I would like to do here is more complicated than that and I can’t find anything in the VB script editor in Bartender to assist me here, nor have I found anything on the forums. I would like to know if the following is possible and maybe some information to get me started.
 

I have a label document that contains a SQL database connection with multiple tables and a query prompt for the production order number.  Of these tables one field has the possibility of containing a field value  similar to <<Item Number = 808>> where 808 is the customer number.  We currently have a program that converts this data into the value in another table (we are not using bartender to print these labels  currently).  I would like to expand the if … else statement so that if this value is found It searches the table (which currently does not exist in the database setup) for the dynamic value of our item number and the
customers number (based upon the returned data of the query prompt) to return a value for the customers item number. 

 

Is this possible?  I tried to do this using the query builder in the database connection but I could never figure out how to make a variable dynamic based upon the query used in the document.


 

4 comments

0
Avatar
Fernando Ramos Miracle
Moderator
Comment actions Permalink

Hello Slickson,

 

I'm afraid that I don't fully understand what you require, could you clarify it?

 

a. What exactly is the "value" your application is converting, that you wish to retrieve? Is it the numeric fragment from the "<<Item Number = XXX">> data contained in the field from your database?

 

How exactly is this value "constructed"?

 

b. Do you need to have BarTender do a "second database connection" to a different table to search for a certain value, using the result from a query applied to the initially connected database?

 

Thanks!

0
Avatar
Legacy Poster
Comment actions Permalink

The "XXX" is the customer number which would be part of the data needed to do a lookup on the table.

 

For instance ... the label document currently takes an input of a sales order line.  That sales order line contains a link to both an item number and customer number.  There is a third table that contains the item number the customer uses (in their system).  In order to retrieve the correct value to display on the label I would need to join to the table using the our item number on the sales line and the dynamic value of the customer number.

 

For b, If I understand your question correctly the answer is no.  The information being retrieved is in the same database, just in a different table that does not have a simple join that can be built using the standard database connection tools.

0
Avatar
Legacy Poster
Comment actions Permalink

Bump

0
Avatar
Fernando Ramos Miracle
Moderator
Comment actions Permalink

Hello Slickson,

 

I'm afraid that BarTender doesn't make a difference between different databases and different tables, all are different sets of data. Unfortunately if through the supported "Multi-Database Join" feature you cannot get the required result, you'll definitively need to retrieve this information through a VB Script. This could be done from a Data Entry Form maybe using a drop-down list control. There are many examples on how to get this done in the forum, below you'll find one of them:

 

http://forums.seagullscientific.com/index.php?/topic/1666-drop-down-list-of-addresses/?p=4842

 

Regards.

Please sign in to leave a comment.