Validating User Prompt Follow

0
Avatar
John Lindmeier

Need to validate the length (8 to 16 feet) from a user prompt. What is the easiest way to accomplish this in Bartender?  Do you need to write a VB script or is there a simpler way?  If VB script, please advise on logic 

7 comments

0
Avatar
Pete Thane
Comment actions Permalink

Are they entering whole feet? In which case you could set the values up as a dropdown list so they have to select the one they want without the need for any VB.

1
Avatar
John Lindmeier
Comment actions Permalink

Fractions could be possible. What VB script would accomplish a check like this?

0
Avatar
Pete Thane
Comment actions Permalink

I couldn't find a way to set up validation on the field itself but this maybe workable for you. It wont stop them from printing but they will see a big warning message.

  • For your length field on the label go to the Data Source tab and give the field a "name", I called mine entryfield
  • Give this field a default value outside of the valid range.
  • Next go to transforms and I would suggest you adjust Character Filter to Custom and the allowable characters to 0123456789 and include a full stop/period symbol.
  • Still on the Transforms enable VB Script and add the following code

If Value <8 then
Value = "XXX"
Else if Value >16 then
Value = "XXX"
Else Value = Value
end if
end if
Value = Value

  • Add onto the label a new text field and go into the properties 
  • Click on the Object Name (Text 7 for example next to the A at the top of the list on the left and tick the Pre-Printed box
  • As this wont print but will only appear in the Preview you may want to adjust the Font so this field stands out quite clearly such as make it red in colour and a large point size.
  • On the Data Source tab change the default value to "Message" or something similar and then select transforms
  • As above chose VB Script and add the following (make sure to select the name of the field you specified above from the objects to the right of the screen for the 2nd line)

Value =""
Value1 = Format.NamedSubStrings("entryfield").Value
If Value1="XXX" Then
Value = "Length must be between 8 and 16 inches please re-enter"
else Value = ""
end if
Value = Value

 Now select your Data Entry form and from the image drop down list add on a Preview of Template below the Length entry field and make this image as large as possible so the users will see the warning clearly. As the operators type in the value then both typed in value and the warning message will appear on the preview below as they type it, so if they are adding in 11 when they type the 1st 1 the warning will be displayed but this will disappear when the 2nd character is entered.

I hope this helps

0
Avatar
John Lindmeier
Comment actions Permalink

Thanks for looking into this Peter!

I'm a bit confused when your logic reads "Value = Value" in both examples

Can you clarify why you have this or are these typos ?

john

0
Avatar
Pete Thane
Comment actions Permalink

These are required to specify what data each of the fields needs to contain after each of the IF statements have finished being processed. 

0
Avatar
John Lindmeier
Comment actions Permalink

Gotcha ya. I'm a little confused as to where this logic should go. You refer to "Text 7 for example" in your comments. Did the example not get posted.

FYI:  We are using v9.4 of Bartender

0
Avatar
Pete Thane
Comment actions Permalink

9.4 that maybe a problem. I cant remember if you can add a preview of the label template on the Data Entry/Prompt screen. Is there an option for this on your version?

Please sign in to leave a comment.