Two Ways Of Printing The Same Label フォローする

1
Avatar
Legacy Poster

Hello,

I've got a label connected to a database filled with production orders. When I want to print this label it should give me the choice between printing from an productionorder-number [b]OR[/b] printing from an item-number. If printing from the productionorder-number it should pull the amount of labels from the database; if printing from an item-number then it should be possible to fill in the amount of labels manually. Is this possible and if yes...how? We're using Bartender 9.3 SR1. Thanks in advance!

11 コメント

0
Avatar
Fernando Ramos Miracle
モデレータ

This indeed could be done on BarTender, althoug it would require a small VB script.

1. What version, edition and build of BarTender are you working with? Note that you'll need at least the Professional edition to generate an event based VB Script.

2. To get this done, you'll need to create two control objects on your Data Entry Form (on older versions was known as Prompt dialog):

a. First one will contain a selection type control object (Radio button list control for example) that allows you to select one of the two options needed.

b. The second control object would be a text input box. In this text box you'll enter the number of copies in case you select the option where you need to manually enter this value.

3. You'll need to relate the number of copies to a data source. You can get this done from the "File>Print..." dialog, clicking in the options button beside the number of copies field.

4. Once you've related the number of copies to this data source, you'll need to give it a name so you can reference it later from the VB script (basically you'll be generating a shared data source).

5. Once all the previous settings are done you'll need to set up an event based VB Script on a new text object (doesn't even need to be printed, you could set it up outside of the actual label if needed). You'll need to set this VB script on the "OnPostPrompt" event with an "If...Then" flow control. Basically it will need to set the value of the shared data source (the one controlling the number of copies) to the data source value or to the manually entered data from the Data Entry Control (it will depend on which option it was selected).

*things to consider:
- When creating a control object you'll need to relate it to a data source or sub string on your label. By naming that data source you can then call the value entered or selected in the Data Entry From from the actual VB Script.

- When generating the VB Script, you can refer to a named sub string or database field from the Category menu, entering the "Data Base Fields" node or the "Shared Data Sources" node ("Shared Sub Strings" for older versions). Doble clicking on them will add the reference onto your code.
0
Avatar
Legacy Poster

[quote name='Fernando R-Seagull Support' timestamp='1343122036' post='2925']
This indeed could be done on BarTender, althoug it would require a small VB script.

1.
[/quote]

Thanks for your reply but could you please be a bit more specific? I'm not very good in VB Script so I'd appreciate any help I can get on this one. Thanks again!
0
Avatar
Fernando Ramos Miracle
モデレータ

Sorry, I added the comment without finishing it (pressed "Tab" and "Enter" in a row by error). Edited my previous comment, please let me know if you need further help.
0
Avatar
Legacy Poster

Thanks again for your help. I did everything you suggested but I don't know how to call the data from the radio button in the vb-script (I'm not good in scripting :mellow:).
Another problem is that I probably not explained that the user should manually input the productionorder-number [b]or[b] [/b][/b]the item-number. It's not going to be easy for me to get this one done...
0
Avatar
Fernando Ramos Miracle
モデレータ

1. You'll need to link the control object on the Data Entry Form to a data source on your label and then link the VB Script to that data source (you'll need to name it to refer to it from the VB Script).

2. If, apart of choosing between sourcing the quantity of labels from a database field or from a manual input, they need to enter an item/product number you could add another text box control object to the data entry form.

3. Do you need to print that entered item/product number somewhere on your label?

4. Do you want to have BarTender select between sourcing from a database and a the manual input the number of copies depending on that item/product number? If that is the case, what is the exact format of both (in what do they differ)?
0
Avatar
Legacy Poster

Hello and thanks for the help again.

We're working with Bartender 9.3 SR1.

I did as you told me to do:

1) I created a radio button on the data entry form

2) I created a text-box (number of copies) and I did connect it to shared "Indentical labels..." The shared name is "copies".

3) I did make a text-object outside the label and called it "input".

4) Another text-box was created for the manually input of the item-number or the production-number. The big difference between the two numbers is that the production-number always starts with "PROD" followed by 8 numbers (i.e. PROD00023483) while the item-number only contains numbers and sometimes "-".
I connected this text-box with the text-object (input).
Isn't true that this text-box is making the radio button unnecessary?

5) I placed another text-object outside the label and selected the "visual basic script". Is this the place where I've to put the script "OnPostPrompt"?

For now only the item-number is printed on the label, I'll see later if it's also useful to print the production-number.

If all this is correct then can you advise me about the script I need?


0
Avatar
Fernando Ramos Miracle
モデレータ

Hello again.

1. Firstly please download and install the latest release for BarTender v9.3 from the below webpage:
http://www.seagullscientific.com/aspx/fixes_93.aspx

2. Indeed if you use the input text object to evaluate if the number of copies should come from the Prompt dialog or the database field then the radio button is unnecessary.

3. In the VB Script object situated outside of your text object you'll need to evaluate the "input" sub string and change the value of "copies" sub string if necessary.

The VB script should look something like this (remember that it needs to be an event based VB Script and you need to enter the code in the "OnPostPrompt" event):

[i]If (Left(Format.NamedSubStrings("input").Value, 4) = "PROD") Then
Format.NamedSubStrings("copies").Value = Field("[b]FieldName[/b]")
End If[/i]

You'll need to edit the "FieldName" value with the actual field on your databas that contains the number of copies.

What this is doing is comparing the 4 left digits of the "input" value (using the "Left()" function) with the "PROD" string, as you said that the production numbers always start with this string. If the result is positive (it's indeed a production number) then the value of "copies" will be changed to the value on your database field. If that is not the case the VB script doesn't do anything and leaves the value coming from the prompt dialog in the "copies sub string.

4. Are you launching a new prompt dialog for each of your database records? Or are you only launching a prompt dialog at the beginning of the print job and then the entered value is valid for all the record on the database? Or is it the case you are using a query prompt to filter the database?
0
Avatar
Legacy Poster

First: thanks again!

I'd like to only use the dialog which we made at the beginning of the print job whereby the entered value is indeed valid for all the selected records from the database. This causes a new problem for me because although I know how to connect to the database (both by using script or the built-in query) I don't know how to solve this one. Does the script look somehow similar as the one used for the "copies"?

[i]If (Left(Format.NamedSubStrings("input").Value, 4) = "PROD") Then
Format.NamedSubStrings("input").Value = Field("_AB_Etiket_omdoos_ProdOpdr.[/i][i]productionnumber[/i][i]")
Else Format.NamedSubStrings("input").Value = Field("_AB_Etiket_omdoos_ProdOpdr.[/i][i]itemnumber[/i][i]")
End If[/i]

So I'm stucked again..
0
Avatar
Fernando Ramos Miracle
モデレータ

Hello,

1. So, if I understand things, you wish to enter once the information on the Prompt Dialog and apply those values to all your database records. For example, if you've got 5 records, you would enter the data once, and then print:

a. If it's a product number: 5 times x amount of copies per record (being x the information contained on the database field, which means it varies on each record)

b. If it's an item number: 5 times y amount of copies per record (being y the information entered in the Prompt dialog with the number of copies. this value is the same for all records).

Is this your case? If not please explain in further detail.

2. In your code you evaluated the "input" substring, but then changed the "input" substring again. Shouldn't you need to change the "copies" substring, which is the one related with the number of copies on your label? If that is the case, the code would be as follows:

[i]If (Left(Format.NamedSubStrings("input").Value, 4) = "PROD") Then
Format.NamedSubStrings("[b]copies[/b]").Value = Field("_AB_Etiket_omdoos_ProdOpdr.productionnumber")
Else
Format.NamedSubStrings("[b]copies[/b]").Value = Field("_AB_Etiket_omdoos_ProdOpdr.itemnumber")
End If[/i]

By the way, in this case you would always source the number of copies from a data source field.
0
Avatar
Legacy Poster

I did start a clean label so I have a clear overview.

1) I created a text-box on the data entry form. This box I'll use for input a production number or an item number. Outside the label I created a VBscript object with the code:

[i]If (Left(Format.NamedSubStrings("input").Value, 4) = "PROD") Then
Format.NamedSubStrings("input").Value = Field("_AB_Etiket_omdoos_ProdOpdr.Productieorder")
Else Format.NamedSubStrings("input").Value = Field("_AB_Etiket_omdoos_ProdOpdr.artikel")
End If[/i]

With the shared substring name "input".

I created some example objects on the label with vbscript:

[i]Dim ad
Dim sql_query
sql_query = "SELECT ""merknaam"" FROM ""_AB_Etiket_omdoos_ProdOpdr"" WHERE ""artikel"" = '" + input + "' OR ""Productieorder"" = '" + input + "'"
set ad = CreateObject("ADODB.Connection") 'create and open ODBC connection
ad.ConnectionString= "DSN=SQL_adm_001"
ad.Open
Set rs = ad.execute(sql_query)
Value = RS("merknaam") [/i]

(merknaam is one of the fields in a record of the database we're using, it's Dutch and so is our Bartender version which makes it sometimes difficult for translation)

All the vbscripts I did put in the "OnPostPrompt" event and it seems to work in every possible way I could test it!

For the amount of labels part there still is a problem. I did exactly as told but the script is not working the way it should be.

[i]If (Left(Format.NamedSubStrings("input").Value, 4) = "PROD") Then
Format.NamedSubStrings("aantal").Value = Field("_AB_Etiket_omdoos_ProdOpdr.Productieaantal")
End If[/i]

When I use a item-number it works fine but with a production-number it should take the field from the database and it does nothing. If I change the [i]Field("_AB_Etiket_omdoos_ProdOpdr.Productieaantal")[/i] for a random number then it will produce this amount. So hopefully anybody can give me some good ideas...:-)
0
Avatar
Fernando Ramos Miracle
モデレータ

Hello, sorry for the delay.

Would you mind sending your BarTender document (.btw file) to our tech support email? I think that way we'll be able to deal with it in a much more timely manner (once we get it done through our tech support please do update this topic).

You'll find our tech support emails in the below webpage (send it to your closest office):
http://www.seagullscientific.com/aspx/technical-support.aspx

Thanks!

ログインしてコメントを残してください。