Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 55831

Adding of currency fields from subgrid in CRM 2011 - Resulting NAN

$
0
0

Hi 

I am trying to calculate the sum of Item cost fields in a sub grid. Item cost field is currency type.

I have attached an event on grid refresh. In that event, looping through all the rows, extracting the item cost value from the cell and adding. I have used the below code

To extract from grid:

var grid = Xrm.Page.ui.controls.get("RequestedItems")._control;
var ids = grid.get_innerControl().get_allRecordIds();

var totalRequestCost=0;

In the for loop:

var x = grid.get_innerControl().getCellValue("item_cost", ids[i]);

totalRequestCost = parseFloat(totalRequestCost) + parseFloat(x);

Issue: The parseFloat is giving the NAN error.

I tried by removing "$" sign and "," from the "x" before converting to parseFloat.

Also tried using parseFloat(x,10), parseFloat(x,10).toFixed(2) and parseInt etc.

Every where i am getting the NAN error. 

Please let me know how to add currency fields. Any help would be appreciated


Viewing all articles
Browse latest Browse all 55831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>