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

Crosstab Row Numbering 2

Status
Not open for further replies.

MRWARNER

Technical User
Nov 6, 2003
20
0
0
US
Help please,

Using Cr9/SQL DB, Crosstabs:

I want to add a column to the left of my row header(name)displaying a numerical sequence (1,2,3,4,5 etc....) I guess it would be like numbering the row header but I want to keep the row header (name) as the alpha sort.

We will be adding new names each month so the number will not be exclusive to the name. It is merely a reference for communication (line item 5 is up for discussion or please look at line item 12).

Example would be

Jan Feb Mar Apr
1. Adam 1 0 5 2
2. Arthur 2 2 2 2
3. Clark 0 6 3 1


Can anybody help please.

Thanks
Michele in Reno
[noevil]
 
You'll probably need to convert to a manual cross-tab.

If you want a number alongside rows in the detail section, you can try the Recordnumber function, if that fails (sortation/grouping can get you), create 2 formulas:

Report header:

whileprintingrecords;
numbervar Pgs:= 0

Details formula:

whileprintingrecords;
numbervar Pgs:=Pgs+1

-k
 
If you are able to insert a group on {table.name} in your main report (even if you are not displaying anything but the crosstabs), you should be able to use the following formula:

whilereadingrecords;
numbervar linecnt;
stringvar name;

if instr(name,{table.name}) = 0 then
(name := name + {table.name};
linecnt := linecnt + 1);
linecnt

Add this as your topmost row in the crosstab. Then go to the customize style tab,highlight the formula and check "suppress subtotals".

Refresh the report after adding the new row field. This should give you a consecutive number to the left of the name field.

-LB
 
If that is not the coolest thing I have seen I dont know what is.

lbass You have helped me more more than once and I am in debted to you.

I dont understand the coding with variables, I dont know if I ever will, but this was beautiful.

Thank you, Thank you! [bigcheeks]

Michele

PS:I removed the grouping and it still worked. Is this OK?
 
I think it will work without a group if you have your report sorted by the name field or if the original order of records is by the name field, so if you refresh the report and still see consecutive numbers, you should be fine.

-LB
 
Hi LB

I did have to put the grouping back in, I lost my order when I reopened the report. Didnt realize I could have just sorted.

Thanks - Again! [thumbsup2]

PS: I have taken 3 different Crystal classes over the past years and they all touched on variables but never went into in depth teachings. How did you learn about these or do you give classes or know someone who does, I would want something specifically about variables?

 
I learned almost everything about variables from this site. You might check out Ken Hamady's website. He has formula examples, etc., and also teaches, as do probably many other contributors to this site.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top