JM Very creative solution - I tried setting up the SUM view to create the rule and found, as you did, that it did NOT work.
David Blocker ----- Original Message ----- From: "J.M. GRATIAS" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, February 25, 2002 3:34 AM Subject: Re: Looking for a rules > > > >>I am looking for a rule able to prevent user to enter new rows or change > >>existing rows such as the sum of Weight-Percentage stay less or equal to > 100 % > > RAStarkey, Dennis, Bennie ... > > Thanks for your help > > The solution is more difficult than I expected ... > > Reason is that a view or a SELECT SUM(Weight_percentage) INTO ... apply > only to existing rows BEFORE the curent row is being updated : it don't > take into account the new being created/updated. > > As you seems interested by this problem, here is a solution that works : > > 1) I added a new column (Total_percentage DOU) in table COMPONENT, and a > rule that prevent it to hold more than 100 : > > RULES 'Total_percentage must be less than 100' FOR component SUCCEEDS + > WHERE Total_percentage <= 100 > > 2) I added 3 expressions in the form : > 1. TEXT vFccompo = ccomposant > 2. DOUBLE vFtotal = (.vFtotal) > 3. DOUBLE Total_percentage = ( Weight_percentage + .vFtotal) > vFccompo is index for the current row > Total_percentage will contains the SUM of Weight_percentage for every row > of the receipt INCLUDING the current one > > 3) An eep is run when exiting column Weight_percentage. > Variable vFtotal will contain SUM of Weight_percentage for every row of the > receipt EXCEPT the current one : > > SELECT SUM(tauxpoids) INTO vFtotal FROM component + > WHERE (cproduit = .vFcourant) AND ccomposant <> .vFccompo > > May be this will help somebody in the future .... > > Best regards, > > J.M. GRATIAS, Logimatique > ================================================ > TO SEE MESSAGE POSTING GUIDELINES: > Send a plain text email to [EMAIL PROTECTED] > In the message body, put just two words: INTRO rbase-l > ================================================ > TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED] > In the message body, put just two words: UNSUBSCRIBE rbase-l > ================================================ > TO SEARCH ARCHIVES: > http://www.mail-archive.com/rbase-l%40sonetmail.com/ ================================================ TO SEE MESSAGE POSTING GUIDELINES: Send a plain text email to [EMAIL PROTECTED] In the message body, put just two words: INTRO rbase-l ================================================ TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED] In the message body, put just two words: UNSUBSCRIBE rbase-l ================================================ TO SEARCH ARCHIVES: http://www.mail-archive.com/rbase-l%40sonetmail.com/
