Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: subreport caption Post Reply Post New Topic
Page  of 2 Next >>
Author Message
lyman
Newbie
Newbie
Avatar

Joined: 01 May 2009
Online Status: Offline
Posts: 12
Quote lyman Replybullet Topic: subreport caption
    Posted: 26 Jun 2012 at 7:20am
I have an on-depand subreport - which is working fine - but the caption for that subreport is the staff member's name, the date of the report, and the originator.  Is there any way for that caption to be displayed in columns.
 
Currently:
Lin Moss   1/1/2012   Susie Queue
Stanley Stanaslowski   6/15/2012   Michael Lasdforal
 
I would like the columns to line up for easier reading.  Working in Crystal X
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 26 Jun 2012 at 7:38am
Are they separate fields in the sub report?  If so you should be able to position them on the page where you want them.  If not you might be able to separate out the date into three different 'fields' with formulas.
IP IP Logged
lyman
Newbie
Newbie
Avatar

Joined: 01 May 2009
Online Status: Offline
Posts: 12
Quote lyman Replybullet Posted: 27 Jun 2012 at 10:43am
I can put the fields on the page, supress the sub-report and layer that sub-report on top of the fields but that creates another issue.  A user who clicks on the fields themselves will not bring up the sub-report, they have click on a 'space' either between the fields or in front of the first field or in back on the last field to bring up that sub-report.  I'm guessing that's why the 'on demand subreport caption' was used but it's not easily readable.  I added a box on the detail line to simulate a checkbox and if the user clicks on it, the sub-report comes up but I like another method so that they could click anywhere on the line and have the sub-report would come up.
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 27 Jun 2012 at 11:55am
I missed the part about it being a on-demand sub-report.  I would think (but have not tried) that the layering would work.  It is something I would have to experiment with.
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 27 Jun 2012 at 1:28pm
I looked into the subreport on demand.  Yes it could be done, but a lot of string manipulation will need to be done.  Basically it will have to be determined the longest length for the names and then pad the names with spaces that are shorter than the longest name.  Then put it all together as one one fixed length string.

I will see if I have time to work out an example tomorrow.
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 29 Jun 2012 at 9:00am
I finally got some time to work up some code.  This code assumes 20 characters max for a name and eight characters max for the date.  It is easy enough to add spaces.

{Name}+space(20-len(trim({Name})))+totext({Date})+space(8-len(trim({Date})))+{Name2}+space(20-len(trim({Name2})))
IP IP Logged
lyman
Newbie
Newbie
Avatar

Joined: 01 May 2009
Online Status: Offline
Posts: 12
Quote lyman Replybullet Posted: 03 Jul 2012 at 4:46am
The columns are not lined up, I think the TRIM function isn't working on the date, since the number of spaces that the columns move correspond with the number of characters in the date.  This is what I added.  I'm trying to fill the whole line.
 
SPACE(41)+ToText({date})+space(25-length(Trim(ToText({date}))))+
{user_name}+space(34-len(trim({user_name})))+{originator_value}+space(30-len(trim({originator_value})))
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 05 Jul 2012 at 12:14pm
You may need to use the optional parameters for the totext (it depends on the data type).  I do not remember the option for a date field.
IP IP Logged
lyman
Newbie
Newbie
Avatar

Joined: 01 May 2009
Online Status: Offline
Posts: 12
Quote lyman Replybullet Posted: 06 Jul 2012 at 7:48am

Adding the extra parameter to the date field helped; the Date and User_Name align in columns but the originator_value field is still shifting on the page with the number of characters in the User_Name. 

 

SPACE(41)+ToText({date},"MM/dd/yyyy")+

space(25-len(Trim(ToText({date},"MM/dd/yyyy"))))+

{user_name}+space(34-len(Trim({user_name})))+

{originator_value}+space(30-len(Trim({originator_value})))

IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 06 Jul 2012 at 8:23am
Strange, it shouldn't (provided the user_name is less than 35 characters long).
IP IP Logged
Page  of 2 Next >>
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.015 seconds.