vasilek Posted April 6, 2004 Posted April 6, 2004 Hello. For example, I have two number fields: N1 and N2. How can I validate the field N2 so that it cannot be left empty when the data was entered in N1 field? In other words, if the user will enter smth in N1, he/she must enter smth in field N2 as well. Many thanks. FileMaker Version: 6 Platform: Windows 2000
Ugo DI LUCA Posted April 6, 2004 Posted April 6, 2004 Why not a lookup ? Create a cTriggerKey that would match your serial or ID field. Then set N2 to lookup its value from N1. Don't forget to uncheck the box "if field is empty" the cTrigger could look something like Case(N1*GetField("N2"),(Status(CurrentTime)*0)+Serial,(Status(CurrentTime)*0)+Serial) Then, whenever you try to enter N2 when N1 is empty, the value you entered will just be nulled. Else, N2 would lookup N1 value. HTH FileMaker Version: 6 Platform: Mac OS 9
Damocles Posted April 7, 2004 Posted April 7, 2004 Vasilek, If you use a third field that is required to be validated by (N1=N2), it will give you a message if they aren't the same. I adjusted N2 so that it automatically fills in when N1 is originally filled-in. Otherwise, you never get the chance to get to N2 before the "not valid" message appears. Hope this helps. Paul FileMaker Version: 6 Platform: Windows XP Two Field Validation.zip
vasilek Posted April 7, 2004 Author Posted April 7, 2004 Sorry, I didn't mean that 'smth' must be equal 'smth'. On the contrary, value in N1 is a price and value is N2 is minimum qty. So, when the user will enter the price in N1, he/she must enter a minimum qty of the product can be sold at this price in N2.
Ugo DI LUCA Posted April 7, 2004 Posted April 7, 2004 Well, this value wouldn't come here by magic. So if it is stored in some place, I still believe a lookup (pretty easy one this time) is what you need to grab it. Or you might enlight us a bit more... Well, in any case, here's one way to make sure your user would enter some value in N2 if N1 is not empty. Now, a script would just bypass any field validation, as well as imports. FileMaker Version: 6 Platform: Mac OS 9 Field2Validation.fp5.zip
Ender Posted April 7, 2004 Posted April 7, 2004 For the field validation for N2, validate by calculation: If(not IsEmpty(N1), not IsEmpty(N2),1) Uncheck "Validate only if field has been modified". Or you could change it so N2 must be empty if N1 is empty: If(IsEmpty(N1), IsEmpty(N2), not IsEmpty(N2)) You could also modify this to check to a range of numbers.
vasilek Posted April 9, 2004 Author Posted April 9, 2004 Of course the value in N2 will not come by magic, the user must enter it. FileMaker Version: 6 Platform: Windows 2000
-Queue- Posted April 9, 2004 Posted April 9, 2004 Just a note for Ugo's enjoyment: If(IsEmpty(N1), IsEmpty(N2), not IsEmpty(N2)) = IsEmpty(N1) xor not IsEmpty(N2).
Ugo DI LUCA Posted April 9, 2004 Posted April 9, 2004 LOL xor is coming up as mushrooms these days FileMaker Version: 6 Platform: Mac OS 9
-Queue- Posted April 10, 2004 Posted April 10, 2004 Yep. It's a powerful logical operator that states either operand may be true, but not both. It's also known as the exclusive or (hence the x), as opposed to the inclusive OR (either or both operands may be true).
Newbies otherlleft Posted April 15, 2004 Newbies Posted April 15, 2004 I found this discussion because I was trying to do the same thing . . . guarantee that if one field is filled in, the second must also be filled in. I actually tried If(IsEmpty(N1), IsEmpty(N2), not IsEmpty(N2)) as the field validation for N2. The result is that the validation never kicks in. Do I need to use the third field for the validation step? Here's another wrinkle - maybe I'm going about this the wrong way: I would like N2 to be filled in by a script that opens another file. The overall plan for my solution is that after the user enters info in one of two fields (N1 or N3) they must execute a script which creates a related record in the second file. They must use Script 1 if they filled in N1, and Script 3 if they filled in N3. My idea is that Script 1 is they only way they can fill in N2, which is not on the layout. Thus, if they don't execute the correct script they will not be permitted to exit the record if I make the validation strict. However, the validation does not occur. Am I missing something obvious?
Ender Posted April 15, 2004 Posted April 15, 2004 It sounds like you want your field validation on N3 instead. Since N2 would only be filled in by a script, you should not have field validations for that field. Or since you will be calling a script anyway to fill in N2, don't use field validations at all. Instead check your data entry when the script is launched--the script checks that only one field is filled in, then it branches to the correct sub-script.
Newbies otherlleft Posted April 16, 2004 Newbies Posted April 16, 2004 You're correct, I want validation on N3 - I got lost in the example there and misstated myself! Nevertheless, since the validation is being ignored, I'm trying to figure out how I can ensure that the field is checked to see if it's valid.
Ender Posted April 16, 2004 Posted April 16, 2004 Did you uncheck "Validate only if field has been modified"?
Recommended Posts
This topic is 7896 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 accountSign in
Already have an account? Sign in here.
Sign In Now