What's the best place to put this multi-row validation ?
A lot of the validation triggers seem to be row level & so checking
other rows is illegal.
Assuming your design ... I'd put a trigger on any block the user
could move to from that block to validate the entire block before
allowing the move.
--
Daniel Morgan
http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp
http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp
damo...@x.washington.edu
(replace 'x' with a 'u' to reply)
>I often have data blocks where I need to validate columns across
>multiple rows for situations where like a user must rank items & there
>should be no gaps & no duplicates.
>
>What's the best place to put this multi-row validation ?
Key-Commit trigger on form level. It allows restricted built-ins. All you need is browse the block
and give an error message if anything is not right or commit if everything's right.
hth
--
Tiago Rocha
Recife - Brasil
www.diariodastrilhas.cjb.net
Thanks for your reply.
I found a way that's close to what I want using post-forms-commit
trigger but I really want a method that fires as soon as the user
tries to leave a data block where they've entered invalid data.
It sounds like the Key-Commit method you mention would be similar to
post-forms-commit and not fire right after a user leaves the data
block.
Thanks for your reply.
I found out that the post-forms-commit trigger is a fairly clean place
to do this kind of validation.
The idea seems to be that from there one can use select validations on
Forms copies of table data and then raise an exception to prevent
Forms from commiting those to the actual database.
However I'd prefer a method that does multi-row validation as soon as
the user leaves a data block.
>It sounds like the Key-Commit method you mention would be similar to
>post-forms-commit and not fire right after a user leaves the data
>block.
I did the kind of validation you want on a When-Validate-Record trigger. I don't know if there are
easier ways, but here go the way I did: I created a record group on the when-new-form-instance. On
that form, there are controls to make sure the record group reflects exactly what's in the block,
per example, on the key-clrblk (clear block) trigger, there are code to clear the record group.
Okay, so, when the when-validate-trigger fires, I did a loop through the record group to check if
the data the user is entering conflicts with the data in any row of the record group. If there is
conflict, I show a warning, if not, there goes another row on the record group... You can try this
using a post-block trigger instead of the when-validate-record. Both triggers does not accept
restricted built ins, so you can't do a "first record - loop - exit when system.last_record = true"
thing, but with record groups you can.
hope this helps, good luck!!!