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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying details & subreport on the same row.

Status
Not open for further replies.

rkin005

Programmer
Jul 4, 2005
9
I'd like some suggestions for displaying some record fields and beside them displaying a subreport for that record, while ensuring the two 'sections' aren't split across different pages.

Specifically I need to create a report that displays Contact details, and next to the contact details I want to display a subreport showing the Team members related to that contact and the strength of that relationship. There could be any number of related team members for each contact.
eg:

[tt]
NAME COMPANY COMMENTS TEAM RELATIONSHIP
Roger Stone ABC Co. Matt Jones Known
Peter Smith Personal


Bob Smith XYZ Co. Bob's a great guy, Sam Jones Strong
must catch up soon. Peter Smith Known
Sam has arranged a Tom Peters Strong
meeting with Bob on
Tues 27th, 3pm.
[/tt]

The way I've set it up currently is using a Parallel Flow, putting the Contact details in one report section/flow and the Team subreport in another report section/flow (including team member names and relationship). This seems to work well, except when we get to the end of a page. If there's enough space at the bottom of the page for the Team section, but not for the contact section, then the Team section is placed in the first page and the Contact section is placed on the second page. Since I'm thinking of these two report sections as comprising a single row this doesn't look good, and will be very confusing for a user. eg:

[tt]
Page 1:
NAME COMPANY COMMENTS TEAM RELATIONSHIP
.
. <some rows displayed correctly>
.
.

Sam Jones Strong
Peter Smith Known
Tom Peters Strong


Page 2:
NAME COMPANY COMMENTS TEAM RELATIONSHIP
Bob Smith XYZ Co. Bob's a great guy,
must catch up soon.
Sam has arranged a
meeting with Bob on
Tues 27th, 3pm.
[/tt]

Is there some way I can force Actutate to put both sections on the same page? Or is there a different way of structuring my report that would work?

One alternative might be to concatenate the team details into a single text field, then everything could be placed on one frame. However, I think it would be very difficult to deal with long names and trying to keep the names and relationship strength in separate columns but still lining up appropriately.

It seems like this must be a common-enough reporting scenario, but I can't see an easy way to do it.

Any thoughts? Thanks in advance.

- Rory
 
You can play around with the page breaks before and after, but sometimes that is more of a hassle than anything.

Look at houw you group you data, perhaps you want a group within a group, or perhaps you want to put some of your data in a header to ensure it carries over in the case that your contacts do.
 
Rory,

It is possible to do this with a Parallel section.

In the first DataStream of your report, put in SQL to retrieve the contact details.

Override the Fetch Function to store the COMPANY value in a global variable.

Insert a Group Section into the first Content section of the report. Group by COMPANIES.COMPANY (or whatever if the COMPANY table.field)

Insert a ParellelSection inside the group in the Content section. Insert 2 subreports into the Parallel section.

Insert a Subpage control into the Subpage section of the Parallel section. Within the Subpage contol, you need to insert 2 Flow controls a nd set the size and position of these flows to be next to each other (an give them meaningful names).

Then in the SubReports, you need to specify which flow is to be used for each subreport. Insert a DataStream and DataRow into each sub-report. Insert a Frame into the Content section of each Sub-Report and drag the required controls into the frame.

Override the ObtainSelectStatement to only bring records related to current Company. Somthing like:

Function ObtainSelectStatement( ) As String
If Not(strCompany="") Then
If Not(WhereClause="") Then
WhereClause=WhereClause & " AND "
End If
WhereClause=WhereClause
& "COMPANIES.COMPANY='"
& strCompany & "'"
End If

FromClause = parseSchema(FromClause)

ObtainSelectStatement = Super::ObtainSelectStatement( )
End Function

I hope that this make some kind of sense to you. I do have a simple example that I just created and so could email it to you, or there is an example provided with Actuate in the folder: Actuate7\ErdPro\EXAMPLES\SubPage.

Pete
 
Thanks for that Pete, that's pretty much where I'd got to: it's successfully returning the right data, but the problem comes when I reach the end of the page. Because Actuate treats the parallel report sections as separate reports it doesn't realise I always want the two to line up. When there is enough room at the bottom of a page for the right-hand report (ie the detail rows) but not enough room for the left-hand report (eg because I have a really long comment) the right-hand frame will be placed on the first page and the left-hand frame on the next page.

I'm now thinking that parallel flows aren't an appropriate solution for this, so I'm just having a single frame and overriding it's BuildFromRow() to dynamically create and position the Team detail rows. So for each call to BuildFromRow() I retrieve the Team members for the current row and loop through creating the appropriate text fields. It's a bit annoying that I can't just create a detail report and lay it out next to the master, but it's the best solution I have so far.

Another possibility I was thinking of is customising the flow so when it adds the detail report's frame it puts it next to the master report's frame, instead of putting it below.

 
Rory,

In one of my reports where I wanted to make sure that a section didn't start at the bottom of the page if it was going to be split onto the next page, I overrid the AddToPageList sub of the parallel like this:

Sub AddToPageList( pageList As AcPageList )
pageList.NeedHeight(2 * 1440) ' This is 2"
Super::AddToPageList( pageList )
End Sub

I don't know if this would help in your case or not.

Pete
 
Thanks for your suggestion Pete. I've ended up implementing it differently - for anyone interested, this is the solution I came up with:

Don't use parallel flows, because of the layout problems noted in the original post. Instead, use a single frame to show both the main rows and the detail rows, as follows.

The frame is set up as per a normal report for the main records, but also with controls to the right based on the detail datarow (in my example they were TeamMemberName and Relationship). In the BuildFromRow() method of the frame I call Super::BuildFromRow() to populate the contact fields, and then I manually retrieve the detail data (Team members related to the current contact). For each detail datarow I create the appropriate controls and add them to the frame. I also overrode the AdjustSize() method of the frame to resize it if needed.

The example I followed for adding dynamic controls was DynamicLeftToRightFlow.rod. This example adds fields to the right, whereas I add them downwards, but it's a good example of how to do this nonetheless. (This might or might not be the same as ltor.rod in some other versions of Actuate.)

The trickiest part was laying the controls out in the right position, particularly if they can grow. NB: If you're using siebel controls you need to set your ssTxtField.ControlAdjusted = False after setting it's position to prevent the ssFrm from moving the control later.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top