How to split a table by two columns

How to split a table by two columns

Postby Otto » Sun Dec 31, 2017 2:27 pm

Hello,
thanks to “MULTI-LAYER” capabilities this does not need much code.

We have a typical report with a table inside.
The table is pretty lengthy and narrow, so we are thinking about splitting it in half and
placing the lower half next to the upper half like so:
Image
Is there an easy way to account for variable-height rows, so if ABC rows are 5cm each and CDEF rows are just 1cm, the split is made like AB/CDEF ?
In EasyReport you do not need to use script code pure FIVEWIN is all you need.

This is the report I made with FW and ER:

Image


The VRD files are like this:

Image


And here is the source code you need:

Code: Select all  Expand view

FUNCTION DruckRegister()

   local oVRD
   local lPreview       := .t.
   local cDruckerName   := ""
   local cTemp          := ""
   local nNr            := 1
   local nColumn         := 1
   local cABC           := 0
   *----------------------------------------------------------
   use ( "sampleDbf" ) new
   select  sampleDbf
   index on field->betrieb  TAG TmpTag TO TEMPIndex TEMPORARY
   set order to tag TmpTag
   select  sampleDbf
   go top

   TPreview():lListViewHide := .T.
   EASYREPORT oVRD NAME ".\xVrd\sample.vrd"  PREVIEW  lPreview TO cDruckerName PRINTDIALOG IIF( lPreview, .F., .F. ) MODAL
   PRINTAREA 1 OF oVRD   ;
      ITEMIDS    { 100, 120 } ;
      ITEMVALUES { "My title", dtoc(  date() )  }

   do while .not. eof()
      nNr += 1
      if nColumn = 1
         if  UPPER( left( sampleDbf->BETRIEB, 1 ) ) <> cABc
            nNr += 2
            cABc := UPPER( left( sampleDbf->BETRIEB, 1 ) )
            PRINTAREA 5 OF oVRD ;
               ITEMIDS    { 100 } ;
               ITEMVALUES { cABc }
         endif
         PRINTAREA 3 OF oVRD ;
            ITEMIDS    { 101, 102 } ;
            ITEMVALUES { sampleDbf->BETRIEB,;
            STR( sampleDbf->nummer) }

      elseif nColumn = 2
         if  UPPER( left( sampleDbf->BETRIEB, 1 ) ) <> cABc
            nNr += 2
            cABc := UPPER( left( sampleDbf->BETRIEB, 1 ) )
            PRINTAREA 6 OF oVRD ;
               ITEMIDS    { 100 } ;
               ITEMVALUES { cABc }
         endif
         PRINTAREA 4 OF oVRD ;
            ITEMIDS    { 101, 102 } ;
            ITEMVALUES { sampleDbf->BETRIEB,;
            STR( sampleDbf->nummer) }
      endif

      if nNr > 65
         nNR := 0
         nColumn += 1

         PRINTAREA 2 OF oVRD
         if nColumn > 2
            nColumn := 1
            PAGEBREAK oVRD
            PRINTAREA 1 OF oVRD   ;
               ITEMIDS    { 100, 120 } ;
               ITEMVALUES { "RKSV - Register", dtoc(  date() )  }
         endif
      endif
      select  sampleDbf
      skip
   enddo

   oVRD:End()

RETURN NIL

//----------------------------------------------------------------------------//


 



Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 5994
Joined: Fri Oct 07, 2005 7:07 pm

Re: How to split a table by two columns

Postby nageswaragunupudi » Sun Dec 31, 2017 2:39 pm

Very nice example
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10208
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 23 guests