Notifications
Announcements
No record found.
Hi,
I just need your help, I would like to know if how to pass the total amount to the field from one of the field in gridtable in form? can you help me on this? thank you
Ivan
*This post is locked for comments
Hi Ivan,
you can write a simple query from the datasource table and fetch the sum of the amount field.
let's say you have a table Table1 and amount field is there. Query will be like :
Select sum(amount) from Table1 where {your condition};
Table1.amount will give you the sum which you can pass as argument._
Field #1 : smmOpportunityTable.TotalNetAmount()
As-is : Sum of field #4
To-be : Default data is sum of field #4, but user can edit it.
the field #1 is in display method which you cannot simply edit it. I want to edit the total amount. I hope you get the situation. Thank you.
Try this it will help you!
static void SumOfField(Args _args)
{
Table1 table1;
;
select sum(Field1) from table1; //Use "where" condition if required
info(strfmt("%1",table1.Field1));
}
You can pass this value where ever you want to!
*If you need to insert this value to gridtable of a form then you can write this code to init() method of that form and assign this value to desire field. So whenever the form is initialized you can see that value in your gridtable field.
@Gautam Verma
What is the purpose of "where table1.RecId !=0" ?
Hi Ivan, you can create a display method in the datasource and put it in the grid. Remark: there will be no data field in the grid control. There will be Data method instead.
Best regards
It will help to fetch all the row records of a table.
Till it finds the records in table it will work.
I have got our question now. As you explained, in total amount field data is coming from a display method which is not editable. But in your case it has to be editable, which seems a bit confusing requirement because total amount is sum of field #4 in sumOpportuinityTable, if user is going to edit it , there is no point in showing some of a particular field. Anyways based on your requirement in place of display method you can use edit() method which will make the field editable as well. Perform the same logic in edit method which will return your total amount.
For more information go through the link.
msdn.microsoft.com/.../aa637541.aspx
Hi Nishant,
Thank you for your response, yes its quite complicated what the client wants because it is not consistent at all. but I managed to set the field as editable since there is a field in the table for the computation.
you can try this display method scenario is same
community.dynamics.com/.../535285
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 4 Most Valuable Professional
Priya_K 4
MyDynamicsNAV 2