View Full Version : move row records to column fields


xcao
04-06-2009, 08:45 AM
I have a crystal report like this:

PersonID, Lastname, Site
12, Abbott, A
12, Abbott, B
12, Abbott, F
34, Smith, C
50, Olson, B
50, Olson, E

Basically a person can be in one or more site. (usually one or at most 4 sites.
We totally have 9 sites.)
Now I would like to pull the report this way- basically pull their sites from row to column, one person has one row.
PersonID, Lastname, Site1, site2, Site3, site4
12, Abbott, A, B, F
34, Smith C
50, Olson, B,E


Thanks

mikelm3
04-07-2009, 12:59 PM
Use the cross-tab option in the menu Insert

xcao
04-08-2009, 09:34 AM
Does it apply to my case as in my previous message by using cross tab?

I cannot figure out how. The site is string, not number, how to total

Srinvb
05-25-2009, 10:50 AM
If i understood the problem correctly then try the below and check the results

Create a group on Person ID,
Create three formula's
@freset
take a shared string variable in @freset place it group header
Shared Stringvar ConcatStr:="";
Take another formula
place in the detail section
@fConcatStr
Shared Stringvar ConcatStr:=ConcatStr + ","+ {Site};

and the final formula
@fDisplayStr
Shared Stringvar ConcatStr;
--use substr to eliminate the last comma.
Substring(ConcatStr,1,len(ConcatStr)-1);

place all the person details in the group footer and suppress the header and detail section

Person id lastname @fDisplayStr in the presonid group footer.

xcao
05-26-2009, 05:31 AM
Thank you very much.
It is very helpful