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

Screwy if statement

Status
Not open for further replies.

UcfMike

IS-IT--Management
Mar 29, 2007
184
US
I'll do my best to explain this.

I have a calculated field which contains a simple if then else statement.

The statement says if field=value then show this number else show this number minus another number.

When I run the report, if the if condition is true it ignores the then statement and does the else statement.

If I remove the else statement, it does the then statement.

Is this to confusing?

Any ideas on what I could be doing wrong?
 
The calculated field calls two other calculated fields to make its own calculation. In one of the other two calculated fieds there is a total function. If I take that out, the report starts to produce the correct numbers. Is that a known Cognos issue?

 
I'm 99% confident I'm getting the error from the total function. Not sure why this breaks an if statement.
 
You might try creating a data item with your if statement and then creating a new data item that sums or totals the first conditional data item.
 
Here is what I discovered. I adjusted the settings for the field that had the total function in it to the following. Aggregate and Aggregate roll-up are now both set to none.

This seemed to solve the problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top