I recently had a requirement to display sum of total volume (a display method) of all the selected records on a List page form. There were two major development tasks in this requirement
Here is the code for your reference if you ever need to do the same.
For sure there will be many other more effective ways of doing this. If you ever had to do and know the best way please share with me as well.
You should also call this method from interactionclass.selectionchanged() method to update value on every record selection.
Hope it will be help full for if you have a similar requirement in future.
Happy DAXing !!
- To loop through all records that user has selected on List Page.
- To set value on a custom control of List Page after calculation.
Here is the code for your reference if you ever need to do the same.
For sure there will be many other more effective ways of doing this. If you ever had to do and know the best way please share with me as well.
protected void setSumOfTotalVolume()
{
ReqPO reqPO;
Volume totalVolume;
Common externalRecord;
FormDataSource frmDs;
FormRun formRun;
FormRealControl frmCtrl;
MultiSelectionHelper helper = MultiSelectionHelper::construct();
helper.parmDatasource(this.listPage().activeRecord('ReqPO').dataSource());
reqPO = helper.getFirst();
while(reqPO.RecId != 0)
{
totalVolume += reqPO.totalVolume();
reqPO = helper.getNext();
}
//Assign value to control on list page
externalRecord = this.listPage().activeRecord('ReqPO');
if(externalRecord.isFormDataSource())
{
frmDs = externalRecord.dataSource();
formRun = frmDs.formRun();
if(formRun)
{
frmCtrl = formRun.design().controlName(formControlStr(ReqTransPOListPage,TotalVolumeField));
if(frmCtrl)
{
frmCtrl.realValue(totalVolume);
}
}
}
}You should also call this method from interactionclass.selectionchanged() method to update value on every record selection.
Hope it will be help full for if you have a similar requirement in future.
Happy DAXing !!

Like
Report
*This post is locked for comments