On Thu, 17 Apr 2008 07:02:50 -0700 (PDT), Grip <grip@[EMAIL PROTECTED]
>
wrote:
>On Apr 17, 1:19 am, FastWolf <wolfsof...@[EMAIL PROTECTED]
> wrote:
>>
>>
>> # titles_lookup = another table occurance of titles
>> # titles::t_id = text field, must be unique
>> # titles::t_idc = calc field that generates a text string by grabbing
>> characters from another text field
>> # titles:t_idv = text field, must be unique
>>
>> I want to create unique values for t_id. There doesn't seem to be a
>> function for testing validation.
>>
>> My idea was to generate an ID (t_idc), stick it in a field (t_idv),
>> and check to see if it already exists in any record by using a value
>> list. The value list consists of all values in t_id. If it's not in
>> the list (does pass validation), then stick it in t_id and save it. If
>> it is in the list (does not pass validation), then append "a" to the
>> end of the ID and check it again. This way the ID is held out of the
>> value list for comparison purposes, and isn't added to the list if
>> it's in there already. It seems like there ought to be a way to do
>> this using the ValueListItems function.
>>
>> thanks in advance
>>
>> --
>> FW
>>
>> FileMaker Pro Advanced 8.5 on Windows XP Pro SP2
>> FileMaker Server 8.0 on Windows 2003 Server R2
>
>To check if a record p***** validation by calculation, you can:
>
>Set Error Capture [On]
>Commit Record/Request
>If[Get(LastErrorMessage) =/= 507]
>do this
>Else If
>do that
>End If
Grip,
I love the elegance of this but I can't make it work. I'm sure I'm
doing something wrong so I'll keep working on it -- I just wanted to
thank you for your help.
>But I agree the method you're using sounds clunky, but I do like the
>use of Value Lists. Instead of using FM's validation tools, I would
>use this series of script steps to get a valid field value:
>
>Set Variable[$list; ValueListItems(Get(FileName); "ValueListName")
>Loop
>Exit Loop If[ IsEmpty(FilterValues( $list; t_id ))]
>Set [$counter; $counter + 1]
>Set Field[t_id; t_id & $counter]
>End Loop
Now THIS I like -- I know FMP's validation tools are very good but
there's something about scripting my own validation that appeals to
me. When I get a chance I'm going to mess around with this.
thanks again
--
FW
FileMaker Pro Advanced 8.5 on Windows XP Pro SP2
FileMaker Server 8.0 on Windows 2003 Server R2


|