Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Analysis Server and Reporting Services (2012)
 Indicator Colour based on expressions

Author  Topic 

sz1
Aged Yak Warrior

555 Posts

Posted - 2013-01-07 : 09:57:45
Hi

I neeed to be able to change the indicator colour depending on a previous figure from an expression. I named the expressions, previous column expression label = per1 and the new expression in the next column label is called perlast1. I have gone to values and states and attempted to add an expression in the colour fx as:

=IIf((Fields!per1.Value) > Fields!perlast1,"Red",(IIf(Fields!per1.Value < Fields!perlast1,"Green",(IIf(Fields!per1.Value = Fields!perlast1,"Orange"))))

This doesnt work...can someone point me in the right direction please

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-01-07 : 10:19:15
Didnt understand what you mean by named expressions. If you mean naming textboxes that contain expressions then you need to access them from Reportitems collection like

=IIf((ReportItems!per1.Value) > ReportItems!perlast1.value...

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

sz1
Aged Yak Warrior

555 Posts

Posted - 2013-01-07 : 10:48:48
Agh that might be where Im going wrong.

I have the indicators showing with this but they are just green regardless pointing upwards, think this be because its reading the start and end default values for the colours. I set the Value field at the top to closed date, assuming I still need a value field? Any idea? nearly there I think...just not changing the arrouw according to the code...I've added the below code into each arrow indicator down, right and up but it still seems to be reading the default values to the right??

Thanks

=IIf((ReportItems!per1.Value) > ReportItems!per2.Value,"Red",(IIf(ReportItems!per1.Value < ReportItems!per2.Value,"Green",(IIf(ReportItems!per1.Value = ReportItems!per2.Value,"Orange","Yellow")))))
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-01-07 : 11:28:52
are the report items inside detail region or footer region?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

sz1
Aged Yak Warrior

555 Posts

Posted - 2013-01-07 : 11:41:05
I have a table directly on the body of the report with 2 rows with 2 columns with 2 expressions on each for comparing. I have not created a footer...just a table direct on the main body of the report.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-01-07 : 11:45:00
If thats case there will be multiple values inside those fields. then it doesn't make sense unless you apply some aggregation over it

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

sz1
Aged Yak Warrior

555 Posts

Posted - 2013-01-07 : 11:50:16
Can you point me in the right direction to start with that?
All 3 arrows have this code
Are you saying it wont read the expression value with this to see if its highter or lower...I just wanted to have if expression 2 is higher/lower than expression 1 change the arrow.

=IIf((ReportItems!per3.Value) > ReportItems!per4.Value,"Red",(IIf(ReportItems!per3.Value < ReportItems!per4.Value,"Green",(IIf(ReportItems!per3.Value = ReportItems!per4.Value,"Orange","Grey")))))
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-01-07 : 11:58:25
are all of rows in same detail level?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

sz1
Aged Yak Warrior

555 Posts

Posted - 2013-01-07 : 12:00:50
Yeah, 2 rows with the 2 expressions each under a different column. 4 expression altogther as I'm doing the same thing twice for different criteria but if it works on one row it will work on the other. Cant send a screenshot here cant see anywhere to add attachment.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-01-07 : 23:58:20
upload screenshot in shared server and post link here

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

sz1
Aged Yak Warrior

555 Posts

Posted - 2013-01-08 : 03:34:02
This ok?

I just noticed that I had brackets around the fist expression and when I removed these the colours correctly changed, now the arrows seem to be working but they are not changing shape, always pointing upwards. for example the figure for yesterday is the same for today for the first expression and the colour is orange which is good but the arrow is still pointing upwards instead to the right. I entered the code into all 3 arrow indicators, one for up, down and right? maybe I need to split the code into each arrow...

http://www.pcfixerman.com/index.php/2-uncategorised/6-screenshot
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-01-08 : 04:18:41
what expression you gave for arrows?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

sz1
Aged Yak Warrior

555 Posts

Posted - 2013-01-08 : 04:31:05
In Values and States for all 3 arrows in the colour expressions I have added the code:

=IIf((ReportItems!per1.Value) > ReportItems!per2.Value,"Red",(IIf(ReportItems!per1.Value < ReportItems!per2.Value,"Green",(IIf(ReportItems!per1.Value = ReportItems!per2.Value,"Orange","Grey")))))

So even for the right arrow the arrow is going upwards with this code although the colour is correct Orange for the same value.

Does the code still read the start and end values that are set?
I thought if you are comparing another figure these values would not be used?

Its looking nearly there...if I can just get the arrows to change now, your help is appreciated.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-01-08 : 04:52:10
hmm...this is colors isnt it? i was asking on expression you used for arrow images

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

sz1
Aged Yak Warrior

555 Posts

Posted - 2013-01-08 : 05:01:57
Yes, next to the actual arrow icons I put the code into the colour expressions, I thought this was also for the arrows?...I added another screenshot here:

http://www.pcfixerman.com/index.php/2-uncategorised/6-screenshot

I thought they would change as the arrows suggest?
Only other thing I can think of is to change the code for each arrow?

Go to Top of Page

sz1
Aged Yak Warrior

555 Posts

Posted - 2013-01-08 : 05:29:31
I see what you mean now under the icons there is also an expression builder...so for ArrowDown,ArrowUp and ArrowSide I need to include this code somehow...

=IIf((ReportItems!per1.Value) > ReportItems!per2.Value,"Red",(IIf(ReportItems!per1.Value < ReportItems!per2.Value,"Green",(IIf(ReportItems!per1.Value = ReportItems!per2.Value,"Orange","Grey")))))

so maybe something like this:
--UpArrow
=IIf((ReportItems!per1.Value) < ReportItems!per2.Value,"ArrowDown")
--ArrowSide
=IIf((ReportItems!per1.Value) = ReportItems!per2.Value,"ArrowSide")
--ArrowDown
=IIf((ReportItems!per1.Value) > ReportItems!per2.Value,"ArrowUp")

Not sure the correct syntax here?



Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-01-08 : 05:40:37
yep...you need to set expression for image property i guess

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

sz1
Aged Yak Warrior

555 Posts

Posted - 2013-01-08 : 06:09:30
Just realised that I dont need all 3 icons as the code will do that using iif statements, so one for the colour like this:

--colour
=IIf((ReportItems!per1.Value) > ReportItems!per2.Value,"Green",(IIf(ReportItems!per1.Value < ReportItems!per2.Value,"Red",(IIf(ReportItems!per1.Value = ReportItems!per2.Value,"Orange","Grey")))))

and one for the icons like this:
--arrows
=IIf((ReportItems!per1.Value) > ReportItems!per2.Value,"ArrowUp",(IIf(ReportItems!per1.Value < ReportItems!per2.Value,"ArrowDown",(IIf(ReportItems!per1.Value = ReportItems!per2.Value,"ArrowSide","ArrowSide")))))

then if I set the start and end values from 0 - 100 that may work?

Does that sound logical to you?

Thanks
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-01-08 : 06:33:24
looks logically fine to me

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

sz1
Aged Yak Warrior

555 Posts

Posted - 2013-01-08 : 06:49:31
Thanks for all your help Visakh much appreciated!! :)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-01-08 : 23:41:27
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
    Next Page

- Advertisement -