create group on report class

create group on report class

Postby artu01 » Tue Aug 09, 2011 7: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
artu01
 
Posts: 400
Joined: Fri May 11, 2007 8:20 pm
Location: Lima

Re: create group on report class

Postby James Bott » Thu Aug 11, 2011 2: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: create group on report class

Postby artu01 » 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
artu01
 
Posts: 400
Joined: Fri May 11, 2007 8:20 pm
Location: Lima

Re: create group on report class

Postby artu01 » Thu Aug 11, 2011 11:21 pm

Sorry
i send it again
Code: Select all  Expand view
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
artu01
 
Posts: 400
Joined: Fri May 11, 2007 8:20 pm
Location: Lima


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 67 guests