Choose Increment Or Decrement Through Prompt
-
One option (apart of duplicating each of your documents) would be to control the serialization through VB Script instead of using the built in feature. This way you could add the increment as a radio button and have the VB Script source from the result (being one option "1" and the other "-1" for example). 0 -
Legacy Poster
★ BarTender Hero ★
That sounds like what I would want to do but I do not know how to do that. I guess I'd like it to show the operator 1 of 2 buttons to click similar to that in the regular bartender software, one to decrement the count, one to increment the count. Clicking one would turn off the other button. If that's possible, I'd appreciate any guidance on how to accomplish that. I basically understand VB code when I see it but I'm not a VB programmer where I can just start from scratch and code up a script. Very new to this. 0 -
[quote name='dmontroy' timestamp='1357662938' post='4020']
That sounds like what I would want to do but I do not know how to do that. I guess I'd like it to show the operator 1 of 2 buttons to click similar to that in the regular bartender software, one to decrement the count, one to increment the count. Clicking one would turn off the other button. If that's possible, I'd appreciate any guidance on how to accomplish that. I basically understand VB code when I see it but I'm not a VB programmer where I can just start from scratch and code up a script. Very new to this.
[/quote]
Hello, I've attached a simple example that uses an event based VB Script to control the serialization and a named Data Source (called "variation" in my example) controlled through a Radio button (which only allows one option to be selected at the same time) to specify the increment/decrement of the serial number.
Basically the radio button can take two values : Increment (1) and Decrement (-1) and the VB Script will always add this selected value to the serial number.
Note that the label of the option and the actual value no the radio button are different (you can change this option in the radio button settings) so instead you could directly see in the radio button 1 and -1 if you prefer.
Please let me know how you get on and happy New Year!0 -
Legacy Poster
★ BarTender Hero ★
I'm not a VB programmer but I thought maybe I could figure out how it works by looking at the code but I'm not getting it. I added a "bag" number field to the sample label you posted and made the initial value 100. It is a prompted field and would be the starting bag number that I want to Increment or Decrement the count on.
I tried to get the Serial Number added to the "Bags" field but all that accomplished was adding 100 to each label along with adding 1. So I ended up with 102, 203, 404. What I really want is the bag# field to change by one (either Up or down) on each label starting with the number entered at the prompt. I just don't see where I can subsitite or insert my new field to work with the 2 fields you have in the label.
Attaching the label you posted plus my additional prompted field that I'm trying use for the starting count#. Please show me how to get the prompted first Bag# to be the starting number and first bag printed.0 -
[quote name='dmontroy' timestamp='1358376283' post='4097']
I'm not a VB programmer but I thought maybe I could figure out how it works by looking at the code but I'm not getting it. I added a "bag" number field to the sample label you posted and made the initial value 100. It is a prompted field and would be the starting bag number that I want to Increment or Decrement the count on.
I tried to get the Serial Number added to the "Bags" field but all that accomplished was adding 100 to each label along with adding 1. So I ended up with 102, 203, 404. What I really want is the bag# field to change by one (either Up or down) on each label starting with the number entered at the prompt. I just don't see where I can subsitite or insert my new field to work with the 2 fields you have in the label.
Attaching the label you posted plus my additional prompted field that I'm trying use for the starting count#. Please show me how to get the prompted first Bag# to be the starting number and first bag printed.
[/quote]
Note that the serialized number is not a "Screen Data" sub-string, but a VB Script type one. What you need to do is enter the "Bag#" object's properties, under the "Data Source" tab, change the sub-string type to "VB Script", then change the VB Script type to an Event based script ("Event Control Scripts") and edit it. Once in script editor, access the "OnSerialize" event and enter the below script:
[i]Value = CInt(Value) + CInt(Format.NamedSubStrings("variation").Value)[/i]
This should get you what you need, I've attached the modified example applying what I just said to it.
Regards!0 -
Legacy Poster
★ BarTender Hero ★
I wasn't able to open the document you created due to it being created on a newer version than what I have ( I'm on Automation 9.4)but I did follow the instructions given and works like I wanted it to so thank you.
It doesn't look like there is a way to update the label in order to keep the bag# of the last label printed as we did before but I think they can live with that.
One last question, is there a way to default the radio button to be the decrement button? It seems to go to Increment no matter which order I list the choices in the table for the radio button. Except for that one printer, all labels need to decrement the count starting with the bag# they enter as the starting bag#. Is that doable?0 -
Legacy Poster
★ BarTender Hero ★
Got it now so the radio button will default to decrement. I just default the value of -1 for the field with the share name variable and the radio button is triggered based on that value.
Lastly, anyway to update the label count field with the serial number of the last label printed? It looks like OnPrintEnd would be the place for the script but I do not know what the code should be to update the label format seeing the update sub-string after print box is greyed out for that field.
It would certainly be helpful if when we launch the printing for that label if we could tell what the last label printed was and use that as a starting point for the next run. Not critical but certainly a convenience if there is a way to do it.0 -
Note that you are using a VB Script to perform the serialization over entered data at print time (through the Data Entry Form). If you wish to save the last printed value you'll need to save it on a separate data source on the label as the VB Script itself won't allow that (you are entering its value at print time).
Actually at the moment the value displayed at design time is 100 because in the "OnAutoSelecteEvent" it's specified that way, but note that this is only for designing benefits and won't have any repercussion at print time (you could delete that value, which would make it appear as "Empty" at design time, and it would still work at print time).
To save that value you would need to save it on a separate data source, simply create a new text object (you could even situate it outside of the printing area), name its data source so it can be accessed from the VB Script, and specify its value from the VB Script in the "OnPrinEnd" event:
[i]Format.NamedSubStrings("<NewDataSourceName>").Value = Value[/i]
If you then wish to use that value so the initial value of the VB Script remember this saved number simply change the "OnAutoSelectedEvent" to:
[i]Value = Format.NamedSubStrings("<NewDataSourceName>").Value[/i]0 -
Legacy Poster
★ BarTender Hero ★
Thanks for the advice on how to save the last label count for continuation label runs. I still have one more issue regarding the serialization.
The prompt to the operator on new batches of labels has them enter the starting bag# but due to using VB to handle the serialization now, the count is incremented or decremented by one before the first label prints. That is different than the way the normal Bartender serialization works and what they have been accustomed to. If the enter bag# 500 as the starting bag# the 1st label printed is 501 and they end up skipping a bag#.
Short of telling the operators to enter the starting bag# 1 number off from what they want to print, is their anyway to either hold off the change in the serialization count until after the first label is printed or a way to automatically alter the entered starting bag number by 1 when the serialization script runs? Maybe use a different field name for the starting bag# on the prompt field and add or subtract 1 from that field then copy that field contents to that field used for serialization? Possible and if so how would you code0 -
To get the serialization to start on the correct number you only need to subtract one to the "Bag" value before the serialization starts. To do that add the below code on the "OnPostPrompt" event:
[i]Value = CInt(Value)-1[/i]
Any action on this event will be carried out after the user entered the information in the Data Entry Form.0 -
Legacy Poster
★ BarTender Hero ★
Thanks, because most of our labels print in descending seq, that line needed to be changed to Value = CInt(Value)+1 and that works. When the operator selects the "Ascending seq" Radio buttoned for the run, The first label out is off by 2, the only way ascending seq works right is if I go in and change that value to the -1.
Can an "If then else" statement be placed in the OnPostPrompt event to test if the radio button value is a +1 or -1 then execute the correct script to either add 1 or subtract 1 from the enterd data?
The OnSerialize code is Value = CInt(Value) + CInt(Format.NamedSubStrings("variation").Value)
What would the If statement be based on the OnSerialize code above if I can use an If, Then, Else code?0 -
Legacy Poster
★ BarTender Hero ★
Thanks to all that pointed me in the right direction and I figured out what the VB code for the IF, then, Else statement needed to be on the OnPostPrompt. Just tested if "varience" = 1 then executed either the +1 or -1 script. 0 -
Legacy Poster
★ BarTender Hero ★
I am making a new label with similar needs and I am using the above suggested scripts and radio buttons to increment or decrement the serialzation as a OnPostPrompt event. The starting number is a prompted field and I have them enter the number as 3 digits including the leading zeros. When the labels print, it only prints the single significate digit and not the leading zeros.
I am using the script below as the OnSerialize script as a way to number the pallets of a given lot# but needs to print 3 characters.
Value = CInt(Value) + CInt(Format.NamedSubStrings("variation").Value)
It now prints 1, 2, 3 etc but I need it to print 001, 002,003 etc.
What do I need to change to force the leading zeros to print?
0 -
Hello Dmontroy,
If you wish your value to contain a minimum number of characters, with leading zeros if that value is not met, you can directly configure it in BarTender (no need to add anything to your script.
-. If you are working with v10.0 or later, access the "Transforms" tab of the data source properties and activate the minimum number of characters feature.
-. On v9.4 or earlier, you'll need to access the "Data Source" tab of the object's properties, select the appropriate substring, click on the "More Options..." button and under the "Minimum" tab activate this same feature.
*I would recommend in both cases deactivated the warning when the minimum is not met, or you'll get a message every time you print.
Regards.
0 -
Legacy Poster
★ BarTender Hero ★
Hello Fernando,
how to get the number leading zeros if i using a global data field? the option Properties>Transforms>Number of Characters is not enable, also i need to combine this label with a date format label, currently i was stuck on leading zeros issue
Thanks in advance
0 -
Hello Geck0,
This something you actually need to configure on the actual Global Data Field properties, instead of doing so on the object with the data source referencing such field. The latter only makes a reference to the value of the global field, but cannot modify it.
If you actually wish to modify such value but only on a specific document first create a "named" data source referencing the global data field, and then use a different data source to reference the value of the named data source (you can do so with a simple VB script type data source).
Regards.
0 -
Legacy Poster
★ BarTender Hero ★
Hi Guru,
This is great information. I noticed all the Data entry form gray out and I can't enter any data on the web browser prompt print. It works great on the bartender software. Is there another way to approve it?
I used your sample "SerializationtypeDM2.btw" file.
Thank you so much for your help,
Eric
Note that the serialized number is not a "Screen Data" sub-string, but a VB Script type one. What you need to do is enter the "Bag#" object's properties, under the "Data Source" tab, change the sub-string type to "VB Script", then change the VB Script type to an Event based script ("Event Control Scripts") and edit it. Once in script editor, access the "OnSerialize" event and enter the below script:
Value = CInt(Value) + CInt(Format.NamedSubStrings("variation").Value)
This should get you what you need, I've attached the modified example applying what I just said to it.
Regards!0 -
Brian Davis
★ BarTender Hero ★
Hi, how can I get the sample files that were attached to this thread? I am wanting to control the serialization "Increment By" using a form (and VB Scripting).
Thanks,
Brian
0
Please sign in to leave a comment.
Comments
18 comments