Show Or Hide A Qr Code Based On A Partial Field Follow

0
Avatar
Legacy Poster

I am hoping someone can see what is broken here with this code ... for the life of me it looks like it should be working but it doesnt.

The below code is in the labels "OnNewRecord" event ... the select case statement is always evaluating to false. I have tried to make sure the array parsing (split) is working by creating a txt field with the appropriate code to confirm that the split and ubound commands would work.

The reasoning behind it is that we only want to print the QR for certain "suffix codes" which are the last set of numbers in a part number. Our part numbers could be 3 to 5 sets of numbers, but the suffix code is always the last value. To automate that I figured the easiest thing would be to split the string into an array and then pull the highest string value back.

Any ideas would be greatly appreciately. Thanks!

[code]
arrLITM = split(Field("DLPTRON.LITM"),"-")
suffixCode = UBound(arrLITM)

set theQR = Format.Objects("SERN_QR")

select case trim(arrLITM(numdata))
case "130","500","520","CZXXX","CZ500","FVE","FVV","CZ520","ITS","ITS50","ITS52","XXX"
theQR.PrintVisibility = True
case else
theQR.PrintVisibility = False
end select
[/code]

2 comments

0
Avatar
Shotaro Ito
Comment actions Permalink

would line 6
select case trim(arrLITM(numdata)) be
select case trim(arrLITM(suffixCode)) ?
0
Avatar
Legacy Poster
Comment actions Permalink

Yep ... that was it. I stared at that code for hours in the factory trying to make it work and never noticed it was a simple variable name that was wrong. Thank you! My new labels go into production today. Yay!

In case anyone ever wants to do something similar ...

From the File menu, go to "BarTender Document Options". Go to the "VB Scripting" tab, then select the "OnNewRecord" event. This is my code:

[code]
arrLITM = split(Field("DLPTRON.LITM"),"-")
suffixCode = UBound(arrLITM)

set theQR = Format.Objects("SERN_QR")

select case trim(arrLITM(suffixCode))
case "130","500","520","CZXXX","CZ500","FVE","FVV","CZ520","ITS","ITS50","ITS52","XXX"
theQR.PrintVisibility = True
case else
theQR.PrintVisibility = False
end select
[/code]

Please sign in to leave a comment.