Jump to content

Validating two fields in one script?


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

Recommended Posts

  • Newbies

Hi. I working and creating a Filemaker database and I would like to be able to validate 2 different fields (ie: date, name) when inputting a new record. Is this possible to do just in the Validation screen or do I have to create a special script for this? If I do have to create a script, any ideas how to go about doing so? Thanks alot in advance for any responses.

Link to comment
Share on other sites

quote:

Originally posted by michamac:

Hi. I working and creating a Filemaker database and I would like to be able to validate 2 different fields (ie: date, name) when inputting a new record. Is this possible to do just in the Validation screen or do I have to create a special script for this? If I do have to create a script, any ideas how to go about doing so? Thanks alot in advance for any responses.

Do you want to validate the two fields so that each of their validation depends in part on the other's value (i.e., never have a record which has the same name and the same date), or are they validated separately?

Chuck

Link to comment
Share on other sites

  • Newbies

quote:

Originally posted by Chuck:

Do you want to validate the two fields so that each of their validation depends in part on the other's value (i.e., never have a record which has the same name
and
the same date), or are they validated separately?

Chuck

When I am inputting a new record with the a specific name and date (ie: John Smith, September 19th, 2000)and there is already a record with those same values (John Smith, September 19th, 2000)I want to show a message saying that there is already a record with those values. I do not, however, want to prohibit the user from inputting another record. Does this make sense? I hope so. Thank you for responding. I would appreciate any ideas.

Link to comment
Share on other sites

quote:

Originally posted by michamac:

When I am inputting a new record with the a specific name and date (ie: John Smith, September 19th, 2000)and there is already a record with those same values (John Smith, September 19th, 2000)I want to show a message saying that there is already a record with those values. I do not, however, want to prohibit the user from inputting another record. Does this make sense? I hope so. Thank you for responding. I would appreciate any ideas.


This is possible, but it's a bit more complex than I can go into here, involving the validation of a calculation field rather than the fields you really want validated and the user of a self-join, I think, to fill in the values. Anyway, go to www.fmfiles.com/tnt1.html. You'll find a file there called "Validate Calculation" which should help you out.

Chuck

Link to comment
Share on other sites

quote:

Originally posted by Chuck:

Do you want to validate the two fields so that each of their validation depends in part on the other's value (i.e., never have a record which has the same name
and
the same date), or are they validated separately?

Chuck

I was wrong, that file doesn't do what I thought it would, so I'll go ahead and describe the procedure. I'll describe what I did when I needed the same kind of thing in my solution.

I had two databases that were related to each other in a many-to-many fashion. I needed to make sure, however, that a particular record in one database would be related to a particular record in at most one time. Each database had a unique id, which for these purposes, I'll call ID1 and ID2. The middle database had fields with these sames and was related to each of these files based on these ID fields.

I needed to make sure that the combination of ID1 and ID2 was unique.

First I created a calculaion field "ID1ID2" which was simply set to equal "ID1 & ID2". I then created a self join relationship with this calculation field as the match field on both sides.

Then I created a text field called "ID1ID2 Dup Check". This was set to lookup the value in "ID1ID2" via the relationship I just created. I then validated the field so that it would only be valid if IsEmpty( ID1ID2 Dup Check ). For my purposes, if the entry wasn't valid, I had a custom dialog box come up and made it so that the validation couldn't be overridden.

Chuck

Link to comment
Share on other sites

This topic is 8610 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.