Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Crosstab in a spreadsheet Report Post Reply Post New Topic
Author Message
omega1983
Newbie
Newbie
Avatar

Joined: 07 Feb 2008
Location: United States
Online Status: Offline
Posts: 6
Quote omega1983 Replybullet Topic: Crosstab in a spreadsheet Report
     Posted: 25 Nov 2009 at 6:37am

I am attempting to display data horizontally in a crystal report.

a. On the detail line I have the following formula call @Hobby
whileprintingrecords;
stringvar Hobby1;
stringvar Hobby2;
If {attribute_full.attrkey} <> 0 and {attribute_full.attrtype}='hobby' then
if Hobby1 = '' then (Hobby1 := {attribute_full.attrcomm}) else
if Hobby2 = '' and {attribute_full.attrid}
 <> Hobby1 then (Hobby2 := {attribute_full.attrcomm})
 
b. On the group header line I reset the formula called @HobbyReset
//whileprintingrecords;
stringvar Hobby1 := "";
stringvar  Hobby2 := "";
 
c. On the actual line that shows the two hobby entries, it looks like this
whileprintingrecords;
stringvar Hobby1;
Hobby1;
there is als one for Hobby2.
 
What I am geeting is repeats.  Here is a sample
ID          Hobby1    Hobby2
122       reading    reading
 
I should be getting
ID          Hobby1    Hobby2
122       reading    fishing
 
By default the data comes over from SQL this way. Note the attrkey instance for a new detail line on the SQL side
attrkey      attrid       attrcomm 
1256         122         reading
1258         122         fishing
 
I want the distinct attrid and show all instances of their attrcomm horizontally as I attempt to do with the code
 
In looking at my code, can you tell what i am doing wrong.  Why is it repeating
omega1983
IP IP Logged
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