FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour create group on report class
Posts: 400
Joined: Fri May 11, 2007 08:20 PM
create group on report class
Posted: Tue Aug 09, 2011 07:56 PM

Hi Friends
I have coded one report with two groups (using the class report)
Its is possible to create an third group at runtime
and the same time can destroy it before the end of the report?

Thanks in advance!

fwh 17.12, harbour 3.2.0, pelles C, bcc7, Ms-Sql
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: create group on report class
Posted: Thu Aug 11, 2011 02:16 AM

If the reason you want to do this is because you only want to use the third group for some versions of the report, you could just define the third group with a conditional.

IF ...
GROUP ON ...
ENDIF

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 400
Joined: Fri May 11, 2007 08:20 PM
Re: create group on report class
Posted: Thu Aug 11, 2011 11:19 PM
James
not all the reports can be make with two groups
I should evaluate each register of the table in runtime.

this is my code but i get the message: TRGroup does not exist

REPORT oRpt ;
...
GROUP oGrp1 ;
ON Left(TMP->Cuenta,2) ;
HEADER Left(TMP->Cuenta,2)+' '+ACONCUE->Descrip;
FOOTER 'Total :' ;
FONT 5

GROUP oGrp2 ;
ON Left(TMP->Cuenta,4) ;
HEADER Left(TMP->Cuenta,4)+' '+ACONCUE->Descrip;
FOOTER 'SubTotal :' ;
FONT 5

COLUMN TITLE " ","Cuenta" ;
DATA TMP->CUENTA ;
FONT 2 SIZE 9

COLUMN TITLE " ","Ruc" ;
DATA TMP->Ruc ;
FONT 2 SIZE 15 aadd(oRpt:aGroups, oRpt:aGroups[3])
...
...

ACTIVATE REPORT oRpt ;
ON STARTGROUP iif(len(tmp->cuentat)=8,createnewgroup(),);
ON ENDGROUP iif(len(oRpt:aGroups)=3, eval({||oRpt:Delgroup(3), oRpt:Stabilize() }),)

END REPORT


Static Function createnewgroup()
oGrp3:= TRGroup:New({|| tmp->cuenta }, {|| tmp->cuenta+" "+aconcue->descrip}, {|| "Subtotal" }, , , oRpt) // Abort TRGroup does not exist
oRpt:Stabilize()
Return Nil
fwh 17.12, harbour 3.2.0, pelles C, bcc7, Ms-Sql
Posts: 400
Joined: Fri May 11, 2007 08:20 PM
Re: create group on report class
Posted: Thu Aug 11, 2011 11:21 PM
Sorry
i send it again
Code (fw): Select all Collapse
James
not all the reports can be make with two groups
I should evaluate each register of the table in runtime. 

this is my code but i get the message: TRGroup does not exist

[quote]REPORT oRpt                                                       ;
    ...
    GROUP oGrp1                           ;
        ON Left(TMP->Cuenta,2)            ;
        HEADER Left(TMP->Cuenta,2)+' '+ACONCUE->Descrip;
        FOOTER 'Total :'           ;
        FONT 5

    GROUP oGrp2                           ;
        ON Left(TMP->Cuenta,4)            ;
        HEADER Left(TMP->Cuenta,4)+' '+ACONCUE->Descrip;
        FOOTER 'SubTotal :'           ;
        FONT 5

      COLUMN TITLE " ","Cuenta"                 ;
            DATA TMP->CUENTA                    ;
            FONT 2 SIZE 9

      COLUMN TITLE " ","Ruc"                    ;
            DATA TMP->Ruc                       ;
            FONT 2 SIZE 15                                                                                                                                                                                 aadd(oRpt:aGroups, oRpt:aGroups[3])
      ...                                             
      ...

     ACTIVATE REPORT oRpt ;
        ON STARTGROUP iif(len(tmp->cuentat)=8,createnewgroup(),);
        ON ENDGROUP iif(len(oRpt:aGroups)=3, eval({||oRpt:Delgroup(3), oRpt:Stabilize() }),)

END REPORT


Static Function createnewgroup()
oGrp3:= TRGroup:New({|| tmp->cuenta }, {|| tmp->cuenta+" "+aconcue->descrip}, {|| "Subtotal" }, , , oRpt) // Abort TRGroup does not exist
oRpt:Stabilize()
Return Nil
[/quote]
fwh 17.12, harbour 3.2.0, pelles C, bcc7, Ms-Sql

Continue the discussion