Well, I tried...
here is the scenario. I have a grid that has two fields one for the balance and one for the total. For both fields I have
alltrim(str( convert_type(<value>,"N") ,250,2,",")) set as the Display format. The database is MySQL and the field type is Decimal(19,4) btw.
Now using the checkbox selector I am able to quickly compute summary totals based on the rows checked and this does work - up to a point.
Problem 1: I would really like to display the $ sign in my display format for the row as in
alltrim(str( convert_type(<value>,"N") ,250,2,"$(")) but if I do I get NAN as a result.
Problem 2: A value of 7,690.05 rounds to $7.00 and I want the exact number not rounded off like that - so in another example, the balance is 700.00 and the total is 1,350.00
The result is Total=$1.00 and Outstanding Balance=$700.00
Here is the OnGridRowCheck code:
I tried to lookup toFixed and parseFloat in the documentation but couldn't find anything, searched the board and still scratching meh head. There doesn't seem to be much in the way of how to in this area - although I probably missed it!
Can you help?
math.JPG
here is the scenario. I have a grid that has two fields one for the balance and one for the total. For both fields I have
alltrim(str( convert_type(<value>,"N") ,250,2,",")) set as the Display format. The database is MySQL and the field type is Decimal(19,4) btw.
Now using the checkbox selector I am able to quickly compute summary totals based on the rows checked and this does work - up to a point.
Problem 1: I would really like to display the $ sign in my display format for the row as in
alltrim(str( convert_type(<value>,"N") ,250,2,"$(")) but if I do I get NAN as a result.
Problem 2: A value of 7,690.05 rounds to $7.00 and I want the exact number not rounded off like that - so in another example, the balance is 700.00 and the total is 1,350.00
The result is Total=$1.00 and Outstanding Balance=$700.00
Here is the OnGridRowCheck code:
Code:
var ele = '';var total = 0; var total2 = 0; var ele2 = ''; var ele3 = ''; for(var i = 1; i <= {grid.object}._rowsInGrid; i++) { ele = $('{grid.componentname}.V.R' + i + '.__ROWCHECKBOX'); if( $gvs(ele) != '') { ele2 = $('{grid.componentname}.V.R' + i + '.GRAND_TOTAL') ele3 = $('{grid.componentname}.V.R' + i + '.REMAINING_BALANCE') total = total + parseFloat($gvs(ele2)); total2 = total2 + parseFloat($gvs(ele3)); } } total = total.toFixed(2); total2 = total2.toFixed(2); $svs('total','$'+total) $svs('total2','$'+total2)
Can you help?
math.JPG
Comment