JM,
Will data be entered or changed outside of a form? If an eep do the
job, I can forward one to you.
Ben Petersen
On 27 Feb 2002, at 5:56, J.M. GRATIAS wrote:
>
> Larry :
>
> >>
> .....
> The problem is that you need to have a primary key on this table, so you
> can exclude the current row from the SUM if the
> row has already been added. Assuming the key is CompID, try the rule like
> this:
>
> RULES 'Receipt incorrect' FOR composition SUCCEEDS +
> WHERE (100 -Weight_Percentage) >= +
> (SELECT SUM(Weight_Percentage) FROM composition T1 +
> WHERE T1.Receipt = composition.Receipt AND +
> T1.CompID <> Composition.CompID)<
> <<
>
>
> Sorry to be the last one to congratulate ....
> Thanks for this very clever rules that is exactly what I was looking for
> ....
>
> But it seems that there is a little problem ... only on the last row of the
> receipt (rules works OK on every row except on the last one for which the
> rules say 'Receipt incorrect' even when it is correct.
>
> I tryed to understand why .... without any success.
> So, I need your help again ....
>
> My table structure is :
>
> CREATE TABLE composition ( +
> cproduit TEXT (11) NOT NULL ('Indiquer le code produit'), +
> ccomposant TEXT (5) , +
> tauxpoids DOUBLE , +
> poidstot DOUBLE +
> clecompo = (cproduit + ccomposant) TEXT 16 NOT NULL +
> )
>
> ALTER TABLE composition ADD FOREIGN INDEX (cproduit) REFERENCES produit +
> ('Cr�ation Interdite : Code non r�f�renc� dans la table PRODUIT', +
> 'Modification Interdite : Code non r�f�renc� dans la table PRODUIT')
>
> ALTER TABLE composition ADD FOREIGN INDEX (ccomposant) REFERENCES composant
> +
> ('Cr�ation Interdite : Code non r�f�renc� dans la table COMPOSANT', +
> 'Modification Interdite : Code non r�f�renc� dans la table COMPOSANT')
>
> ALTER TABLE composition ADD PRIMARY KEY (clecompo) +
> ('Un seul enregistrement pour chaque produit et chaque composant')
>
> RULES 'Composition incorrecte !! : somme des % > 100' FOR composition
> SUCCEEDS +
> WHERE (100 - tauxpoids) >= (SELECT SUM(tauxpoids) FROM composition T1
> +
> WHERE (T1.cproduit = composition.cproduit AND +
> T1.clecompo <> composition.clecompo))
>
>
> Here are my data :
>
> LOAD `composition`
> NONUM
> 'CAKE','SUGAR',10.,
> 'CAKE','FLOUR',50.,
> 'CAKE','EGG',25.,
>
> When I change row 'EGG' from 25 to 20, I get the rule's message ....
> No problem on SUGAR and FLOUR ...
>
> Any idea why ?
>
> TIA
>
>
> J.M. GRATIAS, Logimatique, France
> ================================================
> 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/