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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Move Field(s) into Column(s) 1

Status
Not open for further replies.

lm1340

Technical User
Apr 27, 2015
29
US
Hi,

I want to move a field into a column at each change in [condition]. For each person in my data set, I want to put each of their memberships for the year in a new column. Basically, each person has a single row, even if they have multiple memberships. Each membership would become a new column instead of a new row, but the other data pertinent to the persons record would only output once.

Ex:
[Column 1] [Column 2] [Column 3] [Column 4]
John Smith Phone Membership 1 Membership 2
 
One way to do this is with Shared variables.

First Group on your Member, then split the group footer in two. Suppress the group header, detail, and the second group footer.

Create a formula like this:
//init
shared stringvar memb1 := ' ';
shared stringvar memb2 := ' ';
shared stringvar memb2 := ' ';

put that formula in the Report Header and in the second part of your group footer.

Now create this formula
// memblist
shared stringvar memb1;
shared stringvar memb2;
shared stringvar memb3;
if memb1 = ' '
then (memb1 := {table.membership} ; memb2 := memb2; memb3 := memb3)
else
if memb2 = ' '
then (memb1 := memb1; memb2 := {table.membership}; memb2 := memb3)
else
if memb3 = ' '
then (memb1 := memb1; memb2 := memb2; memb3 := {table.membership})

put that formula in your detail section

Then create a formula like this for each of the variables:
// shomem1
shared stringvar memb1

and place them in the first half of your group footer.
 
Thank you! I think I finally got it working. I actually had up to 12 different memberships, each with the output of conditional messaging. I appreciate your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top