I have been using the 'dbr.calc' command to obtain percentages at both line and summary level. All works well unless the result is negative in which case it returns 0.
dbr.calc doesn't appear to be too happy with negative numbers
(6 posts) (2 voices)-
-
Hi,
could you show your dbr.calc definition and tell which data gets a negative value?--
myDBR Team -
select 'dbr.sum','TC','TX','TI';
select 'dbr.calc','pcnt','(([TI]-[TX]-[TC])*100)/([TI]-[TX])';select b.invNum as 'InvNum',
b.totCost as'TotCost[TC]',
null as 'G/P%[pcnt]',
b.taxAmt as 'TaxAmt[TX]',
b.totInvAmt as 'TotInvAmt[TI]'
FROM pxplus.bi_invHdr bExample from 1 record:
totInvAmt = -200.26
TaxAmt = -15.26
TotCost = -97.56Malcolm Carter - Hub...
........................ -
Hi,
dbr.calc is a formula that is eventually sent to be evaluated by PHP. When you have negative numbers, you can put the variables in the parenthesis. PHP does not like formulas like 3--2. It however is ok with 3-(-2).myDBR could do this automatically so we'll put it in as a CR.
--
myDBR Team -
Added the parentheses and all is well. Thank you very much.. (For both accurate and rapid response).
Malcolm C. - Hub
-
We've added the automatic dbr.calc parentheses in the latest build. Makes the dbr.calc formulas bit easier to read.
--
myDBR Team
Reply
You must log in to post.