Results 1 to 3 of 3

Thread: Formula

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Location
    Kolkata, India
    Posts
    290

    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

  2. #2
    Addicted Member jeanette_db's Avatar
    Join Date
    Oct 2005
    Location
    DC, Phil
    Posts
    215

    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'
    I learnt to plant my own garden instead of
    waiting for someone to bring me flowers
    visit my blog...

  3. #3
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width