I'm sorry that I got your name wrong in my last post, Polychronis, especially as you - along with Larry and JM - seem to have cracked it! Thank you very much to each of you.
Putting the maximum count number first is a neat trick that's well worth remembering. Thanks & regards, Alastair. ----- Original Message ----- From: "ELOEN" <[EMAIL PROTECTED]> To: "RBASE-L Mailing List" <[EMAIL PROTECTED]> Sent: Wednesday, January 29, 2003 11:01 AM Subject: [RBASE-L] - Re: Rule problem > Hi Alastair, > > you are right in that it's not so easy as it seems from the 1st look. > I think this should work now: > > RULE 'Limit of [ 10 ] entries reached!' FOR Top10_Performances SUCC+ > WHERE 10 > (SELE (COUNT(*)) FROM Top10_Performances T1 WHERE+ > T1.Inst_Type = Top10_Performances.Inst_Type AND T1.Top10_Performan_ID+ > <> Top10_Performances.Top10_Performan_ID) > > The idea belongs to Lawrence Lustig and JM (see attachment) and is this: > > 1. You need to have a primary key (Top10_Performan_ID) on this table, so you > can exclude the current row from the COUNT. > 2. You can use a (sub-) SELECT as a 2nd operand in a WHERE clause > > For the check of null values I would prefer NOT NULL Constraint. > > Regards > Polychronis T. Kontos > Athens, Greece > > > > -----Original Message----- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of > > Alastair Burr > > Sent: Tuesday, January 28, 2003 10:46 PM > > To: RBASE-L Mailing List > > Subject: [RBASE-L] - Re: Rule problem > > > > > > Thanks, Eloen, > > > > I tried your suggestion straight away and I think that the rule works (see > > below) - with one change: > > I replaced: > > T1.Inst_Type = Top10_Performances.Inst_Type > > with: > > T1.Inst_Type IS NOT NULL > > > > That's a better solution than an (otherwise useless) view but I can still > > add more than > > 10 rows with the same Inst_Type from the browser/editor as long as I don't > > leave the editor. As soon as I leave and go back then the rule message > > appears when I try to edit where the count is more than 10. > >

