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!

Need help with Layout

Status
Not open for further replies.

MrHelpMe

Technical User
May 1, 2001
203
CA
Hello,

I need some help displaying data on the page. I have created a simple report that shows department(group1), Name(group 2) and territoryCode(ie 101, 102) in the details section. However, I am trying to save the trees here and rather then have the territory code printed like ie
101
102
103
104
and so forth for every name, I want to have this info displayed almost like in an array and shown as follows
[101, 102, 103, 104 and so forth]. Is this possible. Please also note that I do not want to use a crosstab. Thanks for your help and I love this website.
 
Create the following formula and place it in your detail section, then suppress the formula:

========================================================
whileprintingrecords;
stringvar accum;

if onfirstrecord or {name.field}<> previous({name.field}) then
accum:={territory.code}
else
accum:=accum +&quot;, &quot;+{territory.code}
========================================================

To display the field, create the following formula and place it in the group footer:

========================================================
whileprintingrecords;
stringvar accum;
========================================================

Mike
 
Salvatore

It can be done but you will need to capture the territory codes into an array, which is easier said than done. Once you have built your array, then display the contents of that array in the group 2 footer. This can be done with the formula
join([MyArray],&quot; , &quot;)

this puts a space comma space between each element of the array.

Building the array is not an easy task and is not for the faint hearted. Defining the size of the array and then dealing with the empty cells is your biggest problem.

If I were you I would save trees by telling users to view on screen and not print out and go for a columnar presentation

Ian Waterman
UK Crystal Reports Consultant
 
Hi Mbarron,

Thanks for your reply. I tried what you said but then I got an error saying a string can only be 254 characters long. Can I tell the system to put this on the next line or something. Thanks again
 
There are at least two ways around this. The first (and more expensive) would be to upgrade to version 9 which allows for text results of greater than 254 characters.

The other.

change the accumulating formula to:
whileprintingrecords;
stringvar accum1;
stringvar accum2;
stringvar accum3;

if len(accum1)> 240 then
(accum3:=accum2;
accum2:=accum1;
accum1:=&quot;&quot;);

if onfirstrecord or {name.field}<> previous({name.field}) then
(accum1:=territory.code;
accum2:=&quot;&quot;;
accum3:=&quot;&quot;)
else
if accum1=&quot;&quot; then accum1:=territory.code else
accum1:=accum1 +&quot;, &quot;+ territory.code ;
&quot;&quot;

Then to display each field - each &quot;accum#&quot; gets its own formula - just change the accum1 to accum2 in the second formula etc. Strecth the field completely across the canvas. Set the field to &quot;can grow&quot;

whileprintingrecords;
stringvar accum1


Next insert sections below the group footer- you'll need one section for each output field. Put the highest number output field in the lowest lettered section. If you you have two output fields you'll need to insert one section below, and then put output field 2 in GFa and output field 2 in GFb.

Conditionally suppress each band using (I'm assuming the two output fields scenerio I described above):
for GFa
{@output2}=&quot;&quot;
for GFb
{@output1}=&quot;&quot;

It's not going to be a pretty output unless you you &quot;play with&quot; the red 240 above. For example: set it to about 15 characters X the width for TimeNewsRoman size 10. For an 8.5 X 11 in portrait I would use 120




Mike
 
Mr. MBarron,

That works perfectly. Damn, I wish I had a better grasp of how to create formulas like that. Can I ask you, it's probably a stupid question, but are there any books where I can learn to build formulas like this. I think I'm pretty good with crystal, but I could be way more powerful if I had a grasp on creating complex formulas. Any ideas on any good books I can buy?

One more question, if I have to start another question I will, but was wondering can you get the value of a previous record in crystal without using a subreport? For example if I had 4,
5,
6 I would like the report to display 5 and so forth. I need the previous record to be returned. Thanks. Using crystal 8 and 7. Thanks for all your help MBarron.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top