Jump to content

Help With Validation script


This topic is 4248 days old. Please don't post here. Open a new topic instead.

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

Link to comment
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

Link to comment
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
Link to comment
Share on other sites

This topic is 4248 days old. Please don't post here. Open a new topic instead.

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
×
×
  • Create New...

Important Information

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