-
Formula
Hi
I have a table contains the ledger name, op balance and opdc for dr/cr
Gen Table: (Name, OpBal, OpDc)
I want to sum the opbal for opdc='D' and opbal for opdc='C'
Formula:
NumberVar Tdr;
NumberVar Tcr;
if {Gen.Opdc}='D' then
Tdr:=Tdr+Sum({Gen.opbal})
else
Tcr:=Tcr++Sum({Gen.opbal})
Pls guide how to get the result.
Thanks
Asm
-
Re: Formula
i think this will help...
select sum(opbal) as TDR from gen where opdc = 'D'
select sum(opbal) as TCR from gen where opdc = 'C'
-
Re: Formula
You can use Running Totals, you will need two.
In the Summary Section
Set the "Field to Summarize" combobox to opBal
Set the "Summary Type" combobox to Sum
In the Evaluate section
Choose the "Use Formula" option and enter
{Gen.Opdc}= "D" 'for one running total
{Gen.Opdc}= "C" 'and obviously for the other
In the Reset section keep the default of Never
You could also create two formulas
For one
If {Gen.opDB} = "C" Then {Gen.opBal} Else 0
and for the other
If {Gen.opDB} = "D" Then {Gen.opBal} Else 0
Put them in the Details section but Suppress them.
Then Right-click on each one and choose the Insert -> Grand Total menu item.