Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81728

how to summarize two fields?

$
0
0

I feel a bit stupid, but i can't get it working.
I have 2 int fields, (purchase, marge) and i want to display this computed value:
purchase*((100+marge)/100)

Trying:

        { data: null,
                render: function ( data, type, row ) {
                return ( row.tbl_article.purchase + row.tbl_article.marge )}},

        { data: null,
                render: function ( data, type, row ) {
                return ( row.tbl_article.purchase * row.tbl_article.marge )}},

        { data: null,
                render: function ( data, type, row ) {
                return ( row.tbl_article.purchaseb*b((b100 + row.tbl_article.marge) / 100) )}}

When purchase would be 40 and marge would be 10:
outcome:
first example = 4010
second example = 400 = what to expect
third example = 4004

it seems the + sign combines the field instead of computing the value, but the multiply works correct.
What am i doing wrong here?


Viewing all articles
Browse latest Browse all 81728

Trending Articles



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