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