Serialize with vbscript?
I am trying to serialize hyphenated numerical barcode data such as 10-000. If I use the serialization transform it only serializes the last 3 numbers. I can remove the hyphen with vbscript (replace function) AND decrement its value but I need to re-insert the hyphen before printing the next label and stop printing when the number reaches 00-001:
Print the first label value=10-000
Remove the hyphen and decrement value=replace(value,"-","")-1
if value=1 then stop printing ????????????
Re-insert the hyphen and print label value=09-999
Loop
-
You could make it two fields.
The first field (can be placed off the side of the label so it does not print)
- reads the data from the database but is set to numeric only and so the hyphen is removed.
- set to decrement whilst preserving the number of characters with a reset to 10-000 set
- set to have a minimum of 5 characters padding a 0 to the left with the warning disabled.
- Given a "name" on the Data Source tab
The second field
- VB script field with the base Value coming from the "name" used for 1st field
- Use left and right commands to split the field into two parts
- Concatenate the 2 parts together with a "-" in between
i.e something like the below where "hello" is the name I gave to field...
Value = Format.NamedSubStrings("hello").Value
Value1=left(Value,2)
Value2=Right(Value,3)
Value = Value1 & "-" & Value2(I had tried playing briefly with the Character Filter option but it didn't want to play ball but the above seems to work okay.)
0
Please sign in to leave a comment.
Comments
1 comment