FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour EasyReport
Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM
EasyReport
Posted: Tue Aug 04, 2009 10:09 PM
Hello Timm,
I would like to use for EasyReport the following syntax too.
Normally you have to use:

Code (fw): Select all Collapse
PRINTAREA  1   OF oVRD  ;
   ITEMIDS    { …    } ;
   ITEMVALUES { …}


Code (fw): Select all Collapse
PRINTAREA “MYHEADER.V01”   OF oVRD  ;
   ITEMIDS    { …    } ;
   ITEMVALUES { …}



User-friendly names would be more clear.

I changed the method AreaStart to:

Code (fw): Select all Collapse
METHOD AreaStart( nArea, lPrintArea, aIDs, aStrings, lPageBreak ) CLASS VRD
   LOCAL i
   LOCAL nRecords   := 0
   LOCAL nCondition := 0
   LOCAL nPrBefore  := 0
   LOCAL nPrAfter   := 0
  
    if VALTYPE(nArea) = "C"
        nArea := ASCAN( ::aAreaInis,  Upper( ::cAreaFilesDir + nArea ) )
    endif
  
    nRecords   := IIF( ::aControlDBF[nArea] = 0, 1, ::aDBRecords[ ::aControlDBF[nArea] ] )           
    nCondition := VAL( GetPvProfString( "General", "Condition", "1", ::aAreaInis[nArea] ) )          
    nPrBefore  := VAL( GetPvProfString( "General", "PrintBeforeBreak", "0", ::aAreaInis[nArea] ) )   
    nPrAfter   := VAL( GetPvProfString( "General", "PrintAfterBreak" , "0", ::aAreaInis[nArea] ) )   
  
    DEFAULT lPageBreak := .F.

   ::nCurArea   := nArea



It is working.

Timm would you be so kind to review the code.

Thanks in advance
Otto
Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM
Re: EasyReport
Posted: Wed Aug 05, 2009 07:57 AM
Another idea which I think of is to change the
Method new and to dimension the AREAS by default to 100 and change the method like this:

//Areas
::aAreaInis := {}

//new code
::aAreaInis := ARRAY(100)


aIniEntries := GetIniSection( "Areas", ::cDefIni )

FOR i := 1 TO 100
//new codeline
::aAreaInis[I] := "-"

cDef := ALLTRIM( GetIniEntry( aIniEntries, ALLTRIM(STR( i, 5)) , "" ) )

IF .NOT. EMPTY( cDef )

cFile := VRD_LF2SF( ::cAreaFilesDir + cDef )

IF FILE( cFile ) = .F.
AADD( ::aErrors, "2" + CHR(9) + "Area ini file not found: " + cDef )
ENDIF

// AADD( ::aAreaInis, cFile )
//changed
::aAreaInis[I] := cFile

ENDIF

NEXT



Then you could

Use:
#define MY_HEADER 50
#define MY_UNIVERSAL_TITLE 51
#define MY_COPYRIGHT 52




PRINTAREA MY_COPYRIGHT OF oVRD ;
ITEMIDS {…} ;
ITEMVALUES {…}


Best regards,
Otto

Continue the discussion