You just need to override the validateField method. 
public boolean validateField(fieldId _fieldIdToCheck)
{
    boolean             ret;
    ret = super(_fieldIdToCheck);
    if (ret)
    {
        switch (_fieldIdToCheck)
        {
            case fieldnum(TableName, Percent) :
                if (this.Percent > 100)
                {
                        ret = checkFailed("Error message goes here.");
                }
                break;
        }
    }
    return ret;
}

 
Varden Morris 

276 Taralake Terrace N.E. 
Calgary, Alberta T3J 0A1 
Canada 

(403) 366-8434 (H) 
(403) 615-1604 (C)
[EMAIL PROTECTED]
 
 



----- Original Message ----
From: Søren Ager <[EMAIL PROTECTED]>
To: Axapta-Knowledge-Village@yahoogroups.com
Sent: Tuesday, May 20, 2008 3:07:40 AM
Subject: SV: [Axapta-Knowledge-Village] not more than 100 %


Den 20. maj 2008 11:03 skrev Axapta-Knowledge- [EMAIL PROTECTED] ups.com:

> Den 7. maj 2008 12:31 skrev Axapta-Knowledge- [EMAIL PROTECTED] ups.com
> <mailto:Axapta- Knowledge- Village%40yahoog roups.com> : 
> 
>> Has anyone come across this situation in standard AX, suppose you
>> have field called percentage in your form and the total percentage
>> should not be more than 100% if it exceeds so system should throw
>> the error, percentage should be some of values in all the rows.
> 
> In ValidateWrite on the table do something like:
> 

Actually it should probably be:

Table.update

if ((select sum(percent) from mytable).percent> 100)
throw error("Percent over 100"); 

Table.insert

if ((select sum(percent) from mytable).percent+ this.percent> 100)
throw error("Percent over 100"); 

Greetings
Søren
 


      

Reply via email to