FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Summation by condition
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Summation by condition
Posted: Fri Jun 02, 2023 11:36 AM
Hi,

I created xBrowse with FOOTER clause. And he pointed out
Code (fw): Select all Collapse
 oBrw:aCols[1]:nFooterType:=AGGR_SUM
 ........................................................
 oBrw:aCols[n]:nFooterType:=AGGR_SUM
Then, using oBrw:MakeTotals, it is possible to perform summation according to these columns.

Is it possible to perform summation not on all lines, but on some condition ?
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: Summation by condition
Posted: Fri Jun 02, 2023 11:55 AM

Here some samples

  oBrw:Age:bSumCondition  := { |v,o| o:Value % 2 == 1 }, ;

  oBrw:State:nFooterType  := AGGR_COUNT, ;

  oBrw:State:bSumCondition := { |v,o| "A" $ o:Value }, ;

  oBrw:Salary:nFooterType := AGGR_SUM, ;

  oBrw:Salary:bSumCondition := { || .NOT. FIELD->MARRIED }, ;

//oBrw[6]:sel:bSumCondition := { || ( oBrw:cAlias )->selected }

    oBrw:chm_send:nFooterType := AGGR_COUNT

    oBrw:chm_send:bSumCondition := { || if ( ( oBrw:cAlias )->chm_send > 0, .t., .f. ) }

    oBrw:chm_BOU:nFooterType := AGGR_COUNT

    oBrw:chm_BOU:bSumCondition := { || if ( ( oBrw:cAlias )->chm_bounce > 0, .t., .f. ) }



      :aCols[3]:bSumCondition := { |v,o| (cFileName)->(DELETED()) } // You defined Alias



        oBrw:totaal:nFooterType := AGGR_SUM

        oBrw:totaal:bSumCondition := { || ( oBrw:cAlias )->totaal }
Marc Venken

Using: FWH 23.08 with Harbour
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Summation by condition
Posted: Fri Jun 02, 2023 11:58 AM

Thanks, I get it!

Continue the discussion