Re: Filemaker checking value lists
Re: Filemaker checking value lists
- Subject: Re: Filemaker checking value lists
- From: cheshirekat <email@hidden>
- Date: Sun, 15 Apr 2001 09:12:44 -0600
On 04-15-2001 0415, Ehsan Saffari may have typed or relayed in full or in
part ...
>
On 14/04/2001 23:11,cheshirekat <email@hidden> wrote:
>
>
>I'm trying to clean up a Filemaker Pro 5 script that I have with better
>
>error checking. I need to check to make sure that cells are being filled
>
>correctly. One cell is a popupmenu with data from a value list.
>
>
>
>My script accidently filled in a value that was not in the list for
>
>nearly 50 records. Oops. It was a typo I didn't catch. I realize that I
>
>can lock the popupmenu so that only those choices defined in a value list
>
>are used without having "Other..." or "Edit..." but I don't want to do
>
>that. There are other times, when inputting data manually that I need the
>
>"other" and "edit" options. Since the script runs without intervention, I
>
>would like for it to halt if a value that is not in the value list is
>
>passed. Is there any way my AppleScript can check the value against the
>
>items in the value list? I can't find an example of extracting the items
>
>in a value list so that I can compare the value the script is prepared to
>
>input.
>
>
>
>Thanks
>
>
Hello
>
>
Validation is best applied as part of the field definition, it can be
>
strict or overridable, the field can be validated against a particular
>
value list. This requires no code execution (FM or AS). Check the Field
>
Definition dialog for the validation options. Also note that there is a
>
ValueListItems() function under the design functions that returns the VL
>
items, should you wish to validate by script, for when validation needs
>
to be applied after entry.
>
>
In AS you can also get the choices list property of the field class:
>
choices list [r/o] -- The value list for the field
>
>
tell app "FMP" to set meow to choices list of field "kategory" of
>
database 1
>
>
cheers
>
ehsan
Yes. I know I can validate within FM using define field's, however I
wanted my AppleScript to to do the validating so that it can do other
stuff to correct the invalid data. Knowing that I can get the value list
makes it possible for me to make corrections early in the script by
comparing the list to the data. I kind of thought there would be a way to
get the value list in my AppleScript, but I was looking for "value list"
in the dictionary, not "choices" (it's not choices list in my dictionary)
so I'm very glad you provided that missing syntax. I don't know why I
didn't ever look at the description for choices in the dictionary, but
fortunately you did, as I'm sure others have. Thankfully, as it's amazing
how often I can overlook something right in front of me. Good thing it
wasn't a snake!
This works for me.
tell application "FileMaker Pro"
set valuedList to the choices of cell "Category" of database
"Wonderland Secrets"
end tell
Thanks
kat
(happy and sleepy)