Jump to content

strange global validation


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

Recommended Posts

i must be missing something obvious. so far i've always converted FM3 into FM5 files. now i'm starting to modify files directly in FM5. i created a global text field, formatted as radio buttons with two choices. clicking either choice and exiting the record returns the error 'this field is defined to contain only specific values. allow this value?' i don't know where the validation would come from - it's a global field and a custom value list with two choices. any pointers?

thanks,

stefan

Link to comment
Share on other sites

If you define a field as say number and then set validation to allow say numbers from 1 to 10 and then redefine it as global then the validation continues to apply to the global field. The only way to remove or alter the validation is to change the global field back to number (or in your case perhaps text) and then remove the validation and then change it back to global.

Just one of those little idiosyncracies that keep us all on our toes. Mind you, I would have thought the easy way out was for Filemamker to allow you to validate global fields in the usual way!!

Link to comment
Share on other sites

Hey -- there's a topic for a FAQ or Tip if ever there was: "How to Validate Global Fields."

Just yesterday I was trying to validate a global and found I couldn't do it... today I discover I can!

Yeah!

Link to comment
Share on other sites

... except when I tried it (I wanted to validate by calculation) it didn't work. Perhaps it only works for not empty and unique?

Link to comment
Share on other sites

After 5 years of using Filemaker I've come up against a similar problem:

Is there any way to validate a calculation field?

I have 2 number fields which I want to concatenate with some text into a calculation field to give an alphanumeric code. I want this code to be unique. There isn't the option to allow a calc field to be unique and I've tried your trick as per the global fields and it doesn't work for this.

I also tried making the calc field a text field, set to auto-enter a calculation with unique validation, and that doesn't work.

I'd rather find a calc solution as at the moment, I am solving the problem with a script that copies and pastes - and I already have loads of scripts in this file.

Any ideas please?

Link to comment
Share on other sites

The validation isn't really on the calculation field, as it isn't an entry field. Only entry fields are validated in the traditional sense. You can't perform a unique validation as part of the calculation, as it would require a circular reference. Probably the best you can do is to drive a lookup into another field based upon the value of the calculation field and validate the looked-up value (I haven't tried this). The other option is to run a script to perform the validation.

There ought to be another approach. What do the numbers represent? Why does the result have to be created from the two numbers AND be unique? What would you do if it wasn't (change the numbers?)?

-bd

Link to comment
Share on other sites

Thanks, but I couldn't get your look-up suggestion to work - I think because look-up source and destination fields have to be the same type? As the look-up is based on a calc field, I would again be trying to validate the (look-up destination) calc field.

Here's why I don't have much flexibility: this file is for dinner seating plans. The first number field represents a specific dinner table and the second represents a specific seat at a table. Obviously, these fields can't hold unique data as each table has more than one seat, and every table has a seat #1 etc. The calc field builds a unique reference e.g. T 3:12, to ensure that I haven't allocated more than one person to the same seat (a bad move, I can assure you...).

A reference like T 3:12 is pretty easy for banquet staff to understand anywhere in the world and I can't use all numbers, as then there is no way to know whether, say, "312" is Table 3, seat 12, or Table 31, seat 2.

I also can't use letters, as I need the numbers for calculations elsewhere in the file.

Guess I'm stuck with the script approach...

Link to comment
Share on other sites

What about the following idea:

Put the table and the seat number in one number field like 4.01 for table 4, seat 1 or 24.02 for table 24, seat 2, and so on.

In layout mode, you can set a decimal separator of your choice! You can even make to calculated fields for the table number and the seat number, so you could get rid of the leading zeros in the seat numbers below 10.

I think this should work!

gm

[This message has been edited by Gerd Muller (edited March 16, 2001).]

Link to comment
Share on other sites

You should be able to do this with a relationship. Build a self relation based upon a calculated field:

Index (calculation, number, indexed) =

TableNumber + SeatNumber/100

Create another calculated field:

Constant (calc, number, indexed) = 1

Relate Index to Index in the same file (call it SelfByIndex).

You can check for a duplicate table and seat by creating an error flag if a duplicate is entered. This could be a text message ("Error") or container field that gives you a red background to the layout, etc.

Error (calc, text) =

If (SelfByIndex::Constant, "Duplicate Seat", "")

(You didn't mention what a record is in your file, so I hope this is useful).

-bd

Link to comment
Share on other sites

Thanks for your help guys!

The records are people.

I like the numbering suggestion Gerd, but it would mean a major re-write of other scripts in the dbase. Maybe inb the next version....

bd - I'll need to try your idea as I can't get my head round it!

I did think of the following solution, but I'd be grateful if someone more expert could tell me if it's full of holes....

1. Create a selfjoin relationship where calcfield::calcfield

2. Place related field calcfield::calcfield in a portal

3. Create a new calc field Total which sums the number of records showing data in the portal

4. validate one of the Number Fields with this calculation: If(IsEmpty(Total) or (Total = 1) ,0,1)

This should mean that if you enter a value in one of the number fields that results in a non-unique value in the calc field, Total will show "2", and you'll be asked to revert the number field.

Link to comment
Share on other sites

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