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

Crosstab formula issue 1

Status
Not open for further replies.

gav12345

Programmer
Dec 4, 2003
198
GB
Hi,

Using a CR10 stored proc. against Oracle 9i.

I have the following formula (@BuildSDSE):

Code:
whileprintingrecords;
global stringvar standard;
if {GET_CONTRIBUTION_PAGE.CM_ITEM_REF} = "Standard_Deviation" then
    standard := "SD"
else if {GET_CONTRIBUTION_PAGE.CM_ITEM_REF} = "Standard_Error" then
    standard := "SE"

I have a number of groups in the report, one of which contains a crosstab. One of the rows in the crosstab is the formula (@Number):

Code:
whileprintingrecords;
global stringvar standard;
"  Mean" & Chr(13) & "    " & standard & Chr(13) & "     n"

Therefore, as one of the rows in the crosstab I'm trying to display the following over 3 lines:

Mean
SD
n

(or SE where the SD is). Unfortunately, the formula in the crosstab does not pick up the 'standard' variable, so SD or SE are not displayed, i.e.

Mean

n

The thing is, if I put the same formula into the same group as the crosstab, but independently of the crosstab, the formula is displayed correctly, as per the first example above.

What am I doing wrong?

Thanks, Gavin




 
Don't use the variable--you don't really need it. Just use:

if {GET_CONTRIBUTION_PAGE.CM_ITEM_REF} = "Standard_Deviation" then "SD" else
if {GET_CONTRIBUTION_PAGE.CM_ITEM_REF} = "Standard_Error" then "SE"

You could probably also use the variable if you eliminated the whileprintingrecords.

-LB
 
Thanks LB. I did actually try that first, but it resulted in extra rows in the cross-tab, for which I couldn't think of a reason. I'd thought that calculating the SD / SE value earlier on in the report might get round this. The crosstab should look like:

Col 1 Col 2

Mean 0.958 0.056
SD 0.027 0.002
n 10 10

Mean 0.758 0.086
SD 0.017 0.001
n 10 10

....but with the formula you suggested it looks like:

Col 1 Col 2

0.958 0.056

10 10

Mean
SD 0.017 0.001
n

0.958 0.056

10 10

Mean
SD 0.017 0.001
n

The row labelling is correct but I have extra rows. Do you know why the crosstab is behaving like this?

Thanks, Gavin
 
Ah! - Tried your second option (used the 2 formulae but eliminated the whileprintingrecords) which worked. Just have to read up on 'why?' now.

Thanks again, Gavin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top