Page 1 of 1

create group on report class

PostPosted: Tue Aug 09, 2011 7:56 pm
by artu01
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!

Re: create group on report class

PostPosted: Thu Aug 11, 2011 2:16 am
by James Bott
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

Re: create group on report class

PostPosted: Thu Aug 11, 2011 11:19 pm
by artu01
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

Re: create group on report class

PostPosted: Thu Aug 11, 2011 11:21 pm
by artu01
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]