How to print Fields from another DBF related to a Group ?

How to print Fields from another DBF related to a Group ?

Postby ukoenig » Mon Oct 15, 2012 1:21 pm

Hello,

Is it possible, to print inside a group fields from a related DBF ?

Image

DBSELECTAREA(1) // Select Start-DBF as Group
GROUP ON (1)->GROUP HEADER oReport:aGroups[ 1 ]:cValue
oReport:bStartgroup := { || oReport:Say( 1, oReport:aGroups[ 1 ]:cValue ) }

Field < GROUP > defined in DBF 1 and DBF 2 ( relation )

needed to print all products from DBF 2 of defined group in DBF 1 !!!

COLUMN TITLE "Product" DATA (2)->PRODUCT // DBF 2 related to DBF 1 with field GROUP

END REPORT

Any Sample ????

Best Regards
Uwe :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: How to print Fields from another DBF related to a Group ?

Postby ADutheil » Mon Oct 15, 2012 2:54 pm

Assuming oReport is defined STATIC WIDE in the prg.

Code: Select all  Expand view


COLUMN TITLE "Product" DATA " "

ACTIVATE REPORT oReport ON CHANGE ListProduct()


STATIC Function ListProduct()
oReport:BackLine(1)
WHILE (2)->group == (1)->GROUP
    oReport:StartLine()
    oReport:Say( , (2)->FIELD_YOU_NEED )
    oReport:EndLine()
    (2)->( dbSkip() )
ENDDO
oReport:Newline()
RETURN NIL
Regards,

André Dutheil
FWH 13.04 + HB 3.2 + MSVS 10
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: How to print Fields from another DBF related to a Group ?

Postby ukoenig » Mon Oct 15, 2012 3:46 pm

André,

Thank You very much.
I still tested another Solution, maybe a way to use different DBF's ( relations ) ?

1. I create a temporary < PRINT.dbf > with the needed fields to print
2. I collect from the different DBFs the infos and add these to the defined fields
-- some field-calculations must be done ( some are a little bit complicated )
3. I use this created PRINT.dbf for printing
4. next Building the groups with the 1. PRINT-dbf-field

doing it this way, I don't have the problems with relations and calculations.
All infos are included in just one DBF ( Print.dbf )

Is there any possible reason, speaks against this solution ?

Best Regards
Uwe :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: How to print Fields from another DBF related to a Group ?

Postby ADutheil » Mon Oct 15, 2012 5:16 pm

I cant see any problem beyond the time to build the temp dbf. I have a lot of prgs using this solution when the relations and calculations become too hard to do it in one pass. Migrating to SQL was a very good move for me in these cases. You can make some really "hairy" queries with a lightning fast result.
Regards,

André Dutheil
FWH 13.04 + HB 3.2 + MSVS 10
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: How to print Fields from another DBF related to a Group ?

Postby ukoenig » Mon Oct 15, 2012 8:43 pm

André,

I still have a question about < Groups >
The bottom of Groups are showing the Text < Total >
Is there a way to disable this Text, because I need only the Group-title.

Best Regards
Uwe :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: How to print Fields from another DBF related to a Group ?

Postby Marcelo Via Giglio » Tue Oct 16, 2012 2:13 am

Hello,

try some thing like this

Code: Select all  Expand view

oReport:aGroups[i]:bFooter := {|| "" }
 


where i is the group number, if you have a one group only, i = 1

try and comment if it is what you need

regards

Marcelo
Marcelo Via Giglio
 
Posts: 1064
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: How to print Fields from another DBF related to a Group ?

Postby ukoenig » Tue Oct 16, 2012 9:01 am

Marcelo,
Basicly Yes, I added a empty FOOTER

// shows a extra Group-title belongs to a defined Group-field
// --------------------------------------------------------------------
GROUP ON (30)->GROUP HEADER (30)->GRPTITLE FOOTER " "
oReport:bStartgroup := { || oReport:Say( 1, (30)->GRPTITLE ) }

Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 89 guests