Jump to content

Limiting the value of a field


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

Recommended Posts

Hi there!

I've got a question which I figure will have a simple answer. I have a X field in which a user may enter a numeric value. I also have a Y field in which there already is a numeric value. What I need to do, is to limit the value of the X field to the Y one. I know that I could surely do this by creating a value list of some sort, but what I really need is when the user types in, for example, 28 in the X field and that the Y field contains 24, the X field will then be 24. On the other hand, if the user types in 13 in the X field and that the Y field still contains 24, then the X field will indicates 13.

Thanks in advance and let me say that this is truly the best FileMaker Forum ever!

Kroutchenkov

Link to comment
Share on other sites

In the field definitions area for FieldX, use the Option for Validation. You want Validation by calculation. Tell it to make sure:

FieldX less.gif FieldY.

Link to comment
Share on other sites

If you want it not to interrupt the data-entry person in FM6, you'd need a FieldZ for data entry, and turn FieldX into a calc which gives the Min(FieldZ,FieldY).

In FM7 you can have data entry automatically "fixed" by some calculation, but not in FM6, I believe.

Link to comment
Share on other sites

ESpringer said:

In FM7 you can have data entry automatically "fixed" by some calculation, but not in FM6, I believe.

Yes, this can also be done in FM 6! ==> field definition dialog ==> Options ==> Validation tab: "Validated by calculation" (choose also "Strict" at the bottom, so the can't override your Y-Limit, and "Display custom message")

Link to comment
Share on other sites

I believe E's referring to auto-enter calcs that overwrite (or 'fix') the original data. This is doable in <7 with some extra fields to hold the calculation, mod time, and trigger, similar to this post.

Link to comment
Share on other sites

Hi again!

The solutions you all provided to me are working fine, as long as I type values directly in the database. But when I import records from another database, the values imported do not seem to undergo the validation process until I manually change them. Is there a way to validate those imported values?

To be exact, I have an X database with a RESERVATION section that stores data in a RESERVATION2 database via a portal. There is a button in this portal that export the fields of the related records from RESERVATION2 to a TEMP file, record which is then imported via a script in a RENTAL database. Then, there is a relationship between that RENTAL database and the X database in which there is a portal in which are displayed fields of the related-imported record from the RENTAL database. In fact, the button transfers the current reservation to a rental. But when this reservation becomes a rental, I cannot validate the Quantity field, which is in the RENTAL database (join file). Is there a way to do so? Is that a script thing? I handled to add some script steps during the transfer, but there's a problem : the GO TO RELATED RECORD doesn't seem to work properly...

If my question isn't clear, please feel free to tell me. I am not a native english speaker, but I think things should be pretty clear even though.

I'm going to sleep on that... sometimes a bright idea just comes when we're not looking for it...

Thanks again!

Link to comment
Share on other sites

Well, my database changed a lot with the above explanations and my problems are now away... My error was to try to validate the data when the record was imported, but it was much easier to validate it before it was even exported. This way, it works fine and saves me a lot of time when the validation is false, since the user doesn't have to process through the scripts!

Thanks a lot!

Link to comment
Share on other sites

This topic is 6432 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
 Share

×
×
  • Create New...

Important Information

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