COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: niahanth on 19 Jan 2016 11:33:42 PM

Title: Default values for data items in query
Post by: niahanth on 19 Jan 2016 11:33:42 PM
I have a data item in a report in which i should display either paying or not-paying. There are some predefined conditions when i should display paying and when not paying. If the conditions are met the column should display paying or not paying in the report. Can anyone tell how to write the query to display paying or nonpaying in the report.

Thanks
Title: Re: Default values for data items in query
Post by: schrotty on 20 Jan 2016 01:46:03 AM
Hi,

Do you have more informations for us?
Is your model relational or dimensional / DMR ?
List- or crosstab-report?

Maybe the solution is only to create a Data-Item with an Expression like this:
if (1=1) then ('paying') else ('non-paying')

Schrotty
Title: Re: Default values for data items in query
Post by: BigChris on 20 Jan 2016 01:59:51 AM
You can either use an if...then...else condition, or you can use a case statement. If it's a simple set of conditions I'd use the if...then...else, but if it gets complicated I tend to use case

if([Customer] = 'Brian') then ('Paying') else ('Non-Paying')

Case
When [Customer] = 'Brian' and [Invoice_Value]>0 then 'Paying'
When [Customer] = 'Brian' and [Invoice_Value]<=0 then 'Non-Paying'
else 'Paying'
End