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

Stringvar only displaying on last page

Status
Not open for further replies.

mflahive

MIS
Nov 29, 2004
25
US
Hello,
I am having a problem using a stringvar on a report I am working on. Here's what I have for formulas:

@reset located in page header on main report
WhilePrintingRecords;
shared stringvar X := " ";

@declare located in group header (borrower) on subreport
WhilePrintingRecords;
Shared stringVar X;
X := X + {table.field} + chr(10) + chr(13) + chr(10) + chr(13);

@display located in page footer on main report
WhilePrintingRecords;
Shared stringVar X := X;

The subreport is located in a group header which and I am using underlay to fill out a template in the page header. The report is set to have 3 borrowers per page.

The problem I have is when there are > 3 borrowers and then @display shows only on the last page. I would like it to show for whatever borrower is on the page you happen to be looking at (basically 3 per page).

Thank you.
 
If you are trying to collect the borrower name from each of the three groups per page to display at the bottom of the page, then I think you would need to change your formulas to:

//{@pagereset} to be placed in the page header of the main report:
whileprintingrecords;
stringvar y := "";

//{@resetx} to be placed in a group header section of the main report//
above the one in which the subreport is located (or in the group footer):

whileprintingrecords;
shared stringvar x := "";

//{@sharedvar} to be placed in the subreport group header section:
WhilePrintingRecords;
Shared stringVar x;
x := {table.field};

//{@accum} to be placed in the main report in a group section below the one in which the subreport is located:

whileprintingrecords;
shared stringvar x;
numbervar y;

y := y + x + chr(13)+chr(10)+chr(13)+chr(10);

//{@display} to be placed in the main report page footer:
whileprintingrecords;
numbervar y;

Be sure to format this last formula with "Can Grow".

-LB
 
Thank you for your help, unfortunately, I tried the formulas and when I used the {@accum} formula I get an error saying "a number, currency amount, date, time, or date-time is required here" for X.

Should the {@pagereset} be a NumberVar instead of a StringVar?

I'm actually tring to get a comment on each borrower to show which is a field in the table that I am using.

 
Sorry, I was inconsistent. In the {@accum} and {@display} formulas, it should say: stringvar y instead of numbervar y.
If you are collecting comments from the subreport, then place your comment field where I used {table.field}.

-LB
 
No problem :) Now the last page (pg 2) is just showing only one comment and even though it is for the correct borrower, there's only the one borrower on that page and the first page is still blank.

 
Are you sure you have the {@accum} formula placed in a section below the subreport and before the section containing {@reset}?

-LB
 
I just tested my formulas and they work here. Another thought I had was that maybe you weren't capturing the comment from the subreport. If you write a formula in the main report:

whileprintingrecords;
shared stringvar x;

...and place it in a section below the subreport, does it appear? Specifically, if the comment is in one of the detail fields of the subreport, how are you ensuring that it will appear in the group header of the subreport? I guess you should check whether it actually appears correctly in the subreport. You might have to use some sort of summary, e.g., if there is only one comment per group, with other comment fields blank, then you could use a maximum of the comment field to get it in the group header, and then set the shared variable equal to that.

-LB
 
Aside from declaring the variable, I don't use the comment field in the subreport. When I tried your test formula above in the main report, I get the same comment on the one borrower (on the last page only).

{@accum} is placed in the section below the subreport and {@reset} is in the section above the subreport.

I'm a little confused as to what you are saying about using a maximum of the comment field??

Sorry I hope I am not being too much of a pain.
 
The test formula result means the shared variable isn't working right within the subreport. Unsuppress the subreport sections so you can see what's going on. Please provide a sample of data showing where the comment field is in the subreport. If it is in a detail field like this:

Group #1 Header
Detail 1
Detail 2
Detail 3 Comment
Detail 4

...you would have to create a formula like the following:

whileprintingrecords;
shared stringvar x := maximum({table.comment});

Please note that the shared variable formula MUST be placed somewhere on the subreport canvas, even if suppressed.

If you have a series of comments and you want to display all, then create a formula like the following for the detail section of the subreport:

whileprintingrecords;
shared stringvar x := x + {table.comment}+ "; ";

Then create a display formula to be placed in the group footer within the subreport of:

whileprintingrecords;
shared stringvar x;

Once you get the shared variable to appear correctly, then the formulas in the main report should work.

-LB
 
I just found another issue with this report. When I try to preview the subreport, the preview pane is blank and showing zero records which may perhaps be the cause of the comment field not showing???

It's strange that all the information on the subreport shows on the main report preview though.
 
I'm not sure why that would happen, but place the shared variable in your group header and see if it appears on the subreport when you preview the main report.

-LB
 
Hey LB,
I needed a break from this report :) I did solve the subreport not previewing but I am still working on displaying on 3 borrower comments per page. I have since moved the comment field into it's own subreport which is now located in the Page Footer on the Main Report.


I think the reason the formulas weren't working in the other subreport was because the subreport is formatted to multiple columns so that each borrower has information per column, which was then putting the comment field in a column per borrower and previewing at the top of the page since I am also using underlay.

The issue now is the comments appear correctly in one box but all the comments show up on every page whereas I only need 3 borrower comments per page.

Hope you can help. I appreciate all you've done so far.
Thanks.
M

 
I don't think you should use the subreport approach. It still requires that you pass values from the page to the subreport--and that is the same issue you are having in trying to get the comments directly on the page footer. Please read my next to last post and provide some sample data--what it would look like per borrower if you didn't have it formatted for multiple columns. This isn't that complicated a problem, once we see what the data looks like.

-LB
 
Here is what the subreport looks like:

Report Header a
Report Header b
Group Header #1
Group Header #2 - {@sharedvar} group is by borrower ID
Details

The main report -

Report Header
Page Header a - {@pagereset}
Page Header b - template
Group Header #1 - {@resetx}
Group Header #2 - Subreport
Group Header #2b - {@accum}
Details
Group Footer #2
Group Footer #1
Report Footer
Page Footer - {@display}

The {@sharedvar} in the first subreport does not work properly since the group is by Borrower ID. When the subreport is previewed (with or without multiple comments) it seperates the comments per borrower and when the main report is previewed only the comment on the last borrower shows on the 2nd page. That's why I thought it may be best to add the comment field to it's own subreport.

I have to have the Borrower ID group in order for the information on each borrower to complete the template set up in the page header of the main report.

 
You need to change your shared variable formula in the subreport as I suggested earlier:

If the comment is in a detail field like this:

Group #2 Header (Borrower)
Detail 1
Detail 2
Detail 3 Comment
Detail 4

...you would have to create a formula like the following:

whileprintingrecords;
shared stringvar x := maximum({table.comment},{table.borrower);

Please note that the shared variable formula MUST be placed somewhere on the subreport canvas, even if suppressed.

If you have a series of comments and you want to display all, then create a formula like the following for the detail section of the subreport:

whileprintingrecords;
shared stringvar x := x + {table.comment}+ "; ";

Then create a display formula to be placed in the group #2 (borrower) footer within the subreport of:

whileprintingrecords;
shared stringvar x;

Then you would use the formulas I suggested in my first post. Please try this. I believe it will work, as it tests out here.

P.S. The subreport should be linked to the main report on the group #2 field.

-LB
 
I think I figured out why they work for you and not me. My main report did not have the same group by borrower that the subreport did. Meaning the subreport and formulas were on a different group.

The problem with having that borrower group on the main report is then only one borrower prints per page whereas I need to have 3 borrowers per page. The formulas do work when I added the borrower group to the main report and moved the formulas and subreport accordingly.

Again, I truly appreciate your patience and help.
 
Add the group on borrower and place the subreport and formulas there. In order to get three borrowers per page, change {@pagereset} to:

//{@pagereset} to be placed in the page header of the main report:
whileprintingrecords;
stringvar y := "";
numbervar grpcnt := 0;

Change {@accum} to:

//{@accum} to be placed in the main report in a group (borrower) section below the one in which the subreport is located:

whileprintingrecords;
shared stringvar x;
numbervar y;
numbervar grpcnt;

y := y + x + chr(13)+chr(10)+chr(13)+chr(10);
grpcnt := grpcnt + 1;

Then go to the section expert and remove your formatting for new page after on whatever group you have that on, and then highlight the borrower group->new page after->x+2 and enter:

{@accum} = 3

-LB
 
That's the strange part, I don't have the report formatted for a new page after any group so even when I put that formula in the section expert in the borrower group it just changes how the comment field acts on the report and doesn't include 3 borrowers per page. I don't have a new page format on any section of the subreport either (not sure it that matters or not).

When {@accum} = 3 is placed in borrower group header it makes the last borrowers comment blank.

When {@accum} = 3 is placed in borrower group footer it has shows the comments per borrower twice on each page.
 
Hello again,
I am hoping that if I show how the report is set up now since I've made a few changes, maybe it will help to show what I am doing wrong:


MAIN REPORT
Page Header a {@Page Reset}
Page Header b Template (Underlay is used)
Group Header #1 (Pool ID)
Group Header #2 (Rela ID)
Group Header #3 (Borrower)
Details
Group Footer #3a (Borrower) {@resettx}
Group Footer #3b (Borrower) Subreport
Group Footer #3c (Borrower) {@accum}
Group Footer #2 (Rela ID)
Group Footer #1 (Pool ID)
Report Footer
Page Footer {@display}

SUBREPORT
Report Header
Group Header #1 (Pool ID)
Group Header #2 (Rela ID)
Group Header #3 (Borrower) {@sharedvar}
Details
Group Footer #3 (Borrower)
Group Footer #2 (Rela ID)
Group Footer #1 (Pool ID)
Report Footer


The only sections of the main report that aren't surpressed are the Page Headers (which basically contains text objects so they appear as labels for rows of info from the subreport), Group Footer #3b and the Page Footer.

All sections EXCEPT the Group Header #3 of the subreport are surpressed. Along with the shared variable are numerous {table.fields} which complete the template in the Main report located in the Page Header. The subreport Groups are formatted to mupliple columns so each page can show 3 borrowers per page.


My test Pool and relationship has 4 borrowers total. If I change the subreport link to use the Borrower ID linking to Group #3 Borrower ID Name the report shows only one borrower per page (4 pages total) although I am not sure why this is happening.

When I don't link the subreport this way, it shows the 3 borrowers on the 1st page and the 4th on the 2nd page but then repeats these pages (8 pages total). The {@display} shows for all 4 borrowers on every page but the 1st page.

LB - if your reading this I really appreciate your help but for whatever reason I am not able to get these formulas to work.

Thanks a bunch.
M
 
You need to link the subreport to the main report on all three group fields.

Also, be sure to format {@display} to "can grow" and make sure your page footer is large enough to accommodate the results on each page--you have added two line returns after each comment, so this will take up substantial space.

Finally, please show the contents of the formula you are using for {@sharedvar} in the subreport.

I have recreated your report here, and it works as you wish. However, I'm unclear whether you implemented any of my suggestions for capturing the comment in the subreport, so I need to know what you used there.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top