I'm new to AX Please help me

I’ve been asked to display the total of 5 fields in another existing field using forupdate query and if the total is >300 then have to display PASSED in the Result Field… someone please pull me out from this task…

Welcome To DUG!!!

Moving your post to AX forum for faster response…

Thank you Amol

Why would you use ForUpdate to displaying a total? Do you want to actually save the result to database? Are all the fields in the same record or where are they coming from? Does it make sense to use an existing field? By the way, if the existing field has a numeric data type, you can’t ever set its value to “PASSES” - you would have to adjust requirements in some way.

Give more details. Like the table and fields where the data is? and where you want to save the result?

It seems like you want to save the result instead of displaying.

@Martin: sorry using any sql query…ya i want ti store that in DB…all the fields are from the same record only…I did’nt give any relations…and that existing field is string datatype…

@Sriyantha Roshan: Table Name:Class_X

Fields:**(Bio,Chem,Tam,Eng,Math,Total)**Integer DAtatype & **(Studname,Result)**String Datatype

I want to display the total automatically if i enter the values in bio,chem,… fields and if total>300 disp “PASSED” automatically in the Result Field.

If you have all fields in the same record, you don’t need any query - just update Result field in insert() method before super().

Something like:

int total = this.Bio + this.Chem + ...
if (total > 300)
{
    this.Result = "Passed";
}
else
{
    this.Result = int2str(total);
}

If it’s a school project or something, you can happily do that. But I wouldn’t ever do that in a real application - I would either not store total at all (because it can be easily calculated), or store it as a number (so it can be sorted) and convert it to string just for displaying in forms.

Thank u boss got the ans