SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Analysis Server and Reporting Services (2012)
 Indicator Colour based on expressions
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic   

sz1
Constraint Violating Yak Guru

United Kingdom
392 Posts

Posted - 01/07/2013 :  09:57:45  Show Profile  Reply with Quote
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

India
52309 Posts

Posted - 01/07/2013 :  10:19:15  Show Profile  Reply with Quote
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
Constraint Violating Yak Guru

United Kingdom
392 Posts

Posted - 01/07/2013 :  10:48:48  Show Profile  Reply with Quote
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")))))

Edited by - sz1 on 01/07/2013 11:27:05
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52309 Posts

Posted - 01/07/2013 :  11:28:52  Show Profile  Reply with Quote
are the report items inside detail region or footer region?

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

Go to Top of Page

sz1
Constraint Violating Yak Guru

United Kingdom
392 Posts

Posted - 01/07/2013 :  11:41:05  Show Profile  Reply with Quote
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

India
52309 Posts

Posted - 01/07/2013 :  11:45:00  Show Profile  Reply with Quote
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
Constraint Violating Yak Guru

United Kingdom
392 Posts

Posted - 01/07/2013 :  11:50:16  Show Profile  Reply with Quote
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

India
52309 Posts

Posted - 01/07/2013 :  11:58:25  Show Profile  Reply with Quote
are all of rows in same detail level?

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

Go to Top of Page

sz1
Constraint Violating Yak Guru

United Kingdom
392 Posts

Posted - 01/07/2013 :  12:00:50  Show Profile  Reply with Quote
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.

Edited by - sz1 on 01/07/2013 12:02:34
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52309 Posts

Posted - 01/07/2013 :  23:58:20  Show Profile  Reply with Quote
upload screenshot in shared server and post link here

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

Go to Top of Page

sz1
Constraint Violating Yak Guru

United Kingdom
392 Posts

Posted - 01/08/2013 :  03:34:02  Show Profile  Reply with Quote
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

Edited by - sz1 on 01/08/2013 04:10:19
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52309 Posts

Posted - 01/08/2013 :  04:18:41  Show Profile  Reply with Quote
what expression you gave for arrows?

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

Go to Top of Page

sz1
Constraint Violating Yak Guru

United Kingdom
392 Posts

Posted - 01/08/2013 :  04:31:05  Show Profile  Reply with Quote
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.

Edited by - sz1 on 01/08/2013 04:37:29
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52309 Posts

Posted - 01/08/2013 :  04:52:10  Show Profile  Reply with Quote
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
Constraint Violating Yak Guru

United Kingdom
392 Posts

Posted - 01/08/2013 :  05:01:57  Show Profile  Reply with Quote
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?


Edited by - sz1 on 01/08/2013 05:10:15
Go to Top of Page

sz1
Constraint Violating Yak Guru

United Kingdom
392 Posts

Posted - 01/08/2013 :  05:29:31  Show Profile  Reply with Quote
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?




Edited by - sz1 on 01/08/2013 05:34:24
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52309 Posts

Posted - 01/08/2013 :  05:40:37  Show Profile  Reply with Quote
yep...you need to set expression for image property i guess

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

Go to Top of Page

sz1
Constraint Violating Yak Guru

United Kingdom
392 Posts

Posted - 01/08/2013 :  06:09:30  Show Profile  Reply with Quote
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

India
52309 Posts

Posted - 01/08/2013 :  06:33:24  Show Profile  Reply with Quote
looks logically fine to me

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

Go to Top of Page

sz1
Constraint Violating Yak Guru

United Kingdom
392 Posts

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

visakh16
Very Important crosS Applying yaK Herder

India
52309 Posts

Posted - 01/08/2013 :  23:41:27  Show Profile  Reply with Quote
welcome

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

Go to Top of Page
  Previous Topic Topic   
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.34 seconds. Powered By: Snitz Forums 2000