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

Crosstab sequence column sorted on crosstab numeric row 1

Status
Not open for further replies.

smsaji

Programmer
Jun 26, 2005
91
CA
(Starting as a new thread)

This is with relation to the thread : thread149-1130706

This time, I am creating a sequence for a crosstab. The crosstab row is numeric like 12.0, 9.0, 9.0, 5.0 ... In this case will the seqence be generated

lbass had suggested this formula for crosstab string row and it worked great!:

whilereadingrecords;
numbervar x;
stringvar y;

if instr(y, {ProcName.Row_Name}) = 0 then
(y := y + {ProcName.Row_Name} + ", ";
x := x + 1);
x

Now, since the crosstab rowname is numeric, I changed

instr(y, {ProcName.Row_Name}) TO instr(y, totext({ProcName.Row_Name})) AND
(y := y + {ProcName.Row_Name} TO (y := y + totext({ProcName.Row_Name})

but the rows are getting repeated. For example the first three rows are the output. But after the first three rows get displayed, they get repeated. In the duplicated rows, the next sequence shows (no.4. here)

Seq Row_Name_1 Row_Name_2
1 MMM 12.0%
2 DDD 9.0%
3 GGG 9.0%
4 MMM 12.0%
DDD 9.0%
GGG 9.0%

But when I remove the ‘Seq’ from the crosstab rows, it shows up only the three rows, which is correct,

Seq Row_Name_1 Row_Name_2
1 MMM 12.0%
2 DDD 9.0%
3 GGG 9.0%

Will this same formula work to generate a sequence column for crosstab numeric rowname or is there any other way.

thanks
 
lbass,
thank you, I tried your suggestion from the other thread and it works perfectly fine!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top