Jump to content
Sign in to follow this  
Jimbojames30

Help With Validation script

Recommended Posts

Hi All,

Please could someone help or advise me, i am building a database where i will be scanning barcodes into a table each product has two barcodes a product and a lot, all the products begin either 01 or A1 and lots always begin 17 or B2

In access i could validate with an after update event to check the information in the field began with 01 or a1 but how would i go about in file maker 12, just started to use it and have only attended a one day course which this wanst covered

could someone please help me out?, i have been looking at this for ages and im sure it must be somthing i could use with the onobjectvalidate but yet again could be completely wrong?

many thanks

Share this post


Link to post
Share on other sites

Use a formula like:

Let( entry = Left( barcode ; 2 ) ;

  entry = "01" or entry = "A1" )

Share this post


Link to post
Share on other sites

Use a formula like:

Let( entry = Left( barcode ; 2 ) ;

entry = "01" or entry = "A1" )

Hi Fitch,

thanks for your reply, is the to be placed in the validation by calculation, as i need it to check on exit of the field and not at when a new record is been created, i tried to put it in the onobjectvalidate but it doesn't have the Let function

Also sorry never used LET my field Product do that relate you entry or barcode in your formula

I managed to pull out the vba which i used in access, could anyone help me recrate this in script

If Left([barcode], 2) = "+H" Or Left([barcode], 2) = "+M" Then Exit Sub

Beep

Cancel = True

Me.Barcode.Undo

End Sub

Share this post


Link to post
Share on other sites

OnObjectValidate doesn't have any functions. It's a script trigger. You assign the trigger to the field to tell it when to trigger, and what script to run when triggered.

Use the formula I supplied in the script, using the "If" script step. It's not critical to use the Let function, it just makes the calc a little more efficient.

The script would look something like this:

If [ Left( Barcode ; 2 ) = "+H" or Left( Barcode ; 2 ) = "+M" ]

  Exit Script

Else

  Beep

  Exit Script [ Result:0 ]

End If

When you exit with a result of 0 (or "false") it stops the user's action that invoked the trigger, e.g. it keeps you from tabbing out of the field.

  • Like 1

Share this post


Link to post
Share on other sites

mate all i can save is "WOW" you have really helped my out big time i cannot thank you enough for this i have looked at me screen now for about 24 hrs at the same script !!!!!

once again many thanks and thanks for your patience and understanding

:yep: :yep: :yep: :yep: :yep: :laugh2:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

By using this site, you agree to our Terms of Use.