how to make formula amount=quantity*unit price on the form

Hi guys I have table have two fields quantity and unit price what i want is to display amount = quantity * price in some forms
now in which place on the form can i write this formula(amount = quantity * price)
and what the code i can write this by it

Why to write code on forms ?

Write a code in table onValidate Trigger of Quantity /Unit Price Field

It will validate once you fill the value in any of the above field.

Hi Ahmed,

I think your requirement is when we are giving quality and price the amount field is automatically calculate the amount…

For that purpose you can write “Modified Field()” mehod…this override method u can write table level or form level((Form->Datasorce->fields->methods->override method modified)) as your requirement…

In Form level

public void modified()
{

;
table.Amount = table.quantity * table.price;

super();
}

I think this code may helpful to you…

Suresh,

We are talking about Navision and not about Axapta.

Thank you for reply can you told me more details i go to the form then c/al global function then i write show modified method then i copy and past code you told me and replace table with table name i applied or i need but it give me message you have specified unknown variable public why this and which place i can call function

thanks

I m sorry i don’t know you are talking about axapita now how i write code on validate trigger of table i write on validate trigger of quantity

table.amount=table.quantity * table .unit price

but it not work

thanks

Ahmed,

Are you using Navision /Axapta??

i using Navision

You should write

Amount:=Quantity * Unit Price;

Prior to that set your field order .i.e are you going to enter Unit Price first and then quantity then above will work.

Hi,

Sorry Ahmed and Amol…

What you mean about field order

That means when you are entering details that time in which field you are entering data first i.e qty or unit price

Hi suresh,

I follow these steps, but this is not working

Please help me …

Thanks

Darshana

Hi darshana,

that answer for axapta not for navision,…

Hi Suresh,

Yes, I am using Axapta

Please help me for the same…

Thanks

Darshana,

Kindly post your question in Axapta Forum with new post. You will get quick answers.

Hi darsana,

First you try table level override method modified field like…

public void modifiedField(fieldId _fieldId)
{
super(_fieldId);

this.Amount= this.Quantityl*this.Price;
}

This may helpful to you…

Hi Darsana,

if you want to show in form then we can write in table level mmodifiedField or in form level-> DS->Field level- modified method

Note:Write the Code in Form level-> DS->Field level (Amount)

public void modified()
{

super();

if(!Table13.Amount)
{
Table13.Aomunt= Table13.Qty*Table13.Price;
}
}

This may helpful to you.

Hi darsana,

First you try table level override method modified field like…

public void modifiedField(fieldId _fieldId)
{
super(_fieldId);
this.Amount= this.Quantityl*this.Price;
}

This may helpful to you…