Verify 1 Field Against Another For Duplication Follow

0
Avatar
Legacy Poster

I have 2 serial labels that are manually entered by the user for our packaging needs. I'm trying to detect when they might accidentally duplicate the serial on the label accidentally.

I tried to use the OnProcessData command as shown in the code below on SERIAL 2 field but what I'm finding is that when trying to verify the data against SERIAL 1 field it's pulling the value that was on the label prior to the user prompt. Also, when I put something in the Else part of the clause i noticed that this OnProcessData procedure gets called A LOT when modifying or printing.

Anyone have ideas to help please??


Dim aString
Dim bString
aString = Value
bString = Format.NamedSubStrings("Serial1")

If aString = Format.NamedSubStrings("Serial1") Then
MsgBox ("DUPLICATE" )
Format.CancelPrinting("TEST")
Else

End If

4 comments

0
Avatar
Shotaro Ito
Moderator
Comment actions Permalink

[quote name='sjesweak' timestamp='1328290807' post='1657']
I have 2 serial labels that are manually entered by the user for our packaging needs. I'm trying to detect when they might accidentally duplicate the serial on the label accidentally.
[/quote]

Hi sjesweak,

To compare multiple user prompt input, try Event control script.
Create a dummy text at off-label, and make that as VB Script source, Event control script.
In OnPostPrompt event, set script like below.
[code]If Format.NamedSubStrings("S1").Value = Format.NamedSubStrings("S2").Value Then
Format.CancelPrinting "Error",""
End If[/code]

OnPostPrompt event runs only once after user prompt has been closed, and it properly reflect user's prompt input.
One drawback is - you don't have an option to return to prompt dialog, unlike OnPostPrompt.

When you give "" to 2nd parameter of CancelPrinting, it doesn't allow you to continue print.

Hope that helps.

[attachment=109:CancelPrinting.btw]
0
Avatar
Legacy Poster
Comment actions Permalink

That worked great!!

[quote name='Shotaro I -Seagull Support' timestamp='1328515499' post='1661']
Hi sjesweak,

To compare multiple user prompt input, try Event control script.
Create a dummy text at off-label, and make that as VB Script source, Event control script.
In OnPostPrompt event, set script like below.
[code]If Format.NamedSubStrings("S1").Value = Format.NamedSubStrings("S2").Value Then
Format.CancelPrinting "Error",""
End If[/code]

OnPostPrompt event runs only once after user prompt has been closed, and it properly reflect user's prompt input.
One drawback is - you don't have an option to return to prompt dialog, unlike OnPostPrompt.

When you give "" to 2nd parameter of CancelPrinting, it doesn't allow you to continue print.

Hope that helps.

[attachment=109:CancelPrinting.btw]
[/quote]
0
Avatar
Christian Vargas
Comment actions Permalink

Hi guys. I want to do the same thing. But instead of comparing a Scan to another Scan to detect the duplicate, I need to compare a scan to a range, to check if the value in the scan is found anywhere in that range, to detect if it's a duplicate. For example, the range would be something like, ALL Rows of Column B of Table 2

 

OR is there a way to detect if a Scan is a duplicate by checking if it was previous scanned on a past print job  by using the Reprint Station records?

0
Avatar
Shotaro Ito
Moderator
Comment actions Permalink

If you have multiple input box on the same dialog, then you can possibly compare each variable in VB Script (repeat IF-Then patterns)
if you need to compare with previous print job's value, I don't have a good idea. Perhaps consider to adjust reader device's setting (usually they have option to prevent double scan) or operator's workflow.

 

 

Please sign in to leave a comment.