Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

REPORT WIHT MULTIPLE BANDS 2

Status
Not open for further replies.

dexterdg

Programmer
Jan 6, 2013
85
PH
as of my knowledge, report populates it contents according to the current query contained in a cursor e.g. SELECT * FROM tbl_db INTO CURSOR temp

anyone there can help me how can i populate this report with multiple bands? i need to populate it with the list of people and each people listed and each among them listed below them is their family member.

e.g.
Person 1
------family member 1
------family member 2
------family member 3
Person 2
-------family member 1
-------family member 2
Person 3
------family member 1
------family member 2
------family member 3
------family member 4

thanks a lot in advance! this has been troubling me for so long. :X
Dexter
 
Dexter,

It's not quite right to say that a report is populated as from a SELECT ... INTO CURSOR. More accurately, a report is populated from a specific table or cursor (or view). It doesn't matter whether it is a permanent table, a cursor that already exists in the current session, or one that's created specifically to run the report.

In this particular case, you would need a cursor or table that contains one record for each row in the report, that is, for each family member. I'm not clear what the relationship is between persons and famly members in this context, but essentially the cursor record would need to contain the details you want to show in each row (that is, each family member), plus an indication of which person that family member belongs to.

In the report, you would then group on the person: Go to the Reports menu (in the Report Designer), select Grouping, and click the Add button. In the next dialogue, type the name of the field that indicates the person (it might be the person's name or, more likely, some sort of ID).

That's basically all there is to it. If you don't know how to create the cursor, please give us more information about the data, and, in particular, what the relationship is between persons and family members.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
anyone there can help me how can i populate this report with multiple bands?

As Mike has indicated above, you do not need Multiple Bands.
Instead your VFP Report Form would need a Group within which the Detail Band(s) would appear.

You would accumulate your data into your Report Data Table very roughly like:
Person1 Family member1 data...
Person1 Family member2 data...
Person1 Family member3 data...
Person2 Family member1 data...
Person2 Family member2 data...
Person2 Family member3 data...
<etc.>
Your Group would them be established on the Person

Good Luck,
JRB-Bldr
 
i kinda want it in a format i earlier mention. for orderliness reasons if thats the output iam to expect like sir jrbbldr said. i did have read articles online with that grouping and i mentioned multiple bands for the reason that it was what is stated there. its just that i cant understand what the author wants to say link: and i kinda wanna replicate the same output. is there a workaround with this or something? x( its killing me

thanks
Dexter
 
If you acquire your data like I suggested and you have your VFP Report Form set up with the appropriate Group and Detail bands, you will get what you indicated in your above posting.

If you have questions regarding how to do this, you might want to look over the free on-line VFP tutorial videos at: Of particular interest might be: Basic Reporting - Pt. 1 & Pt. 2

Good Luck,
JRB-Bldr
 
mr.JRB-Bldr,
seems like in the print tutorial 1 & 2 in the link you gave me didn't even get close to my problem.

to reiterate:
i have two(2) tables
tbl_persons pk= id
tbl_family pk = id


and i wanna tell the report designer(because i only knew how to tell print designer with its contents is from a form.scx[because its an application]; i will set the cursor's content with sql and call REPORT FORM rptCombined PREIVEW/TO PRINTER PROMPT NOCONSOLE) to print the names on the tbl_persons and check if they have the same id at tbl_family. if true then print the list of the people that got ".T." below the name of the person on tbl_persons. if false, just list the name of the person(tbl_persons) and skip the listing of tbl_family to conserve spacing. i hope i have explained it well.

Thanks,
Dexter
 
oh its ok now.. i have figured it out.. thanks for the insights!

Dexter
 
Maybe I missed it, but I do not recall your mentioning that the data was coming from 2 different data tables.

But the best way to prepare data for a Report would be to create a data Cursor containing just want you want to have printed - and most often make that data come together using a SQL Query which combines the fields from different tables (if that is necessary) into a single data cursor.

Somewhat like:
Code:
SELECT <whatever>;
  FROM TABLE1, TABLE2;
  WHERE <some criteria>;
  INTO CURSOR ReportData

SELECT ReportData
REPORT FORM <Your Report Form> NOCONSOLE TO PRINT

Regardless, I am glad that it sounds like you have it working.

Good Luck,
JRB-Bldr

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top