COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: mohsin2010 on 19 Jan 2011 12:11:24 AM

Title: Change Colour Of Data On Condition !
Post by: mohsin2010 on 19 Jan 2011 12:11:24 AM
Hi,

   i want to show the report having three columns First Name,Last Name,Salary and want to make a condition on salary column that the person whose salary is less then 6000 then its salary would be written in Red colour??

Thanks in Advance,

Mohsin
Title: Re: Change Colour Of Data On Condition !
Post by: PRIT AMRIT on 19 Jan 2011 12:20:51 AM
Create a Boolean variable:

[Salary]<6000

Associate the variable with the salary Column. In the Conditional explorer,
Click Yes, then in properties change the background color to 'Red'

Thanks
P
Title: Re: Change Colour Of Data On Condition !
Post by: mohsin2010 on 19 Jan 2011 12:28:46 AM
PRIT,

   i knew that we have to use the variable for the salary column but what should we write in the condition column that if salary <6000 then .. .
      How do i write for changing the "Text colour of Salary Column" ??

Regards,

Mohsin

Title: Re: Change Colour Of Data On Condition !
Post by: PRIT AMRIT on 19 Jan 2011 12:46:25 AM
Unlock first, then click on the 'Text' then apply the variable and change the color conditionally....
Title: Re: Change Colour Of Data On Condition !
Post by: mohsin2010 on 19 Jan 2011 12:58:22 AM
PRIT,

in boolean variable  name "Text"  i give condition like

(IF ( [Query1].[SALARY]<6000 ) THEN
    ( 'Yes' )
ELSE
    ( 'No' ))

but how do this condition would know o change the text color of Salary ???

Thanks,

Mohsin

Title: Re: Change Colour Of Data On Condition !
Post by: PRIT AMRIT on 19 Jan 2011 01:15:43 AM
Not sure what u want though, find attached XML and let me know if this is your requirement?
Title: Re: Change Colour Of Data On Condition !
Post by: mohsin2010 on 19 Jan 2011 01:24:11 AM
i do not get through XML file ...  . .i told you that i want to change the color of data of salary on the condition if salary is less then 6000 then it will be written in red color otherwise it would be in black color like,

FIRST_NAME        LAST_NAME          SALARY
  JOHN                  ANDERSON            8000
  PEIT                     KHALI                5000

now for this condition what shoul i do to my condition in the previous post  ??? 

Thnaks,

Mohsin
Title: Re: Change Colour Of Data On Condition !
Post by: ksr on 19 Jan 2011 01:34:34 AM
no need to use if .... else construct in the case of boolean variable..you can directly write the expression as [salary]<6000
steps:
1) go to condition explorer
2) drag boolean variable from tool box to variable folder then you will get expression dialogue box, build the expression by taking your salary query item
it would lokk like [salary]<6000
3) validate it and click OK, you will return to condition explorer
4) go to page explorer, clik on salary column, under properties assign "boolean1" to style varible property
5) go to conditional explorer, you will see values like YES, NO...
just select YES, then the page explorer will turn into green colour
now in the properties pane, select foreground color proerty, select RED colour
6) double click the "page explorer" to turn off the green colour

just run the report.

regards
KSR

Title: Re: Change Colour Of Data On Condition !
Post by: PRIT AMRIT on 19 Jan 2011 01:49:50 AM
pls find attached...
Title: Re: Change Colour Of Data On Condition !
Post by: mohsin2010 on 19 Jan 2011 02:51:12 AM
Ksr,

   yup i have got it thanks for helping me .. ..


PRIT,

   you too also i got from your attachment ... .thanks :)


Best Regards,
Mohsin