简体   繁体   中英

SSRS Report Builder: Creating text color expression based on textbox value?

Is it possible to have SSRS look at the value of a text box after calculating it, and then apply an expression to determine the color of the text?

More specifically, I have a lot of different text boxes that contain custom formulas to calculate percentages. Normally, I would create an IIF statement in the text color expression builder like this:

IIF([complex formula]<0,"RED","GREEN"). 

This works fine, but when you have a ton of these textboxes, each with different formulas, it would be much more efficient to just copy one standard color expression into them like this:

IIF(This.Value>0,"RED","GREEN")

Are expressions like this possible in SSRS?

The answer is yes, if you are using a very recent version of SSRS:

=IIF(Me.Value < 0,"Red","Green")

Link to original article here

Hope that helps.

It's not as clean, but if you need to refer to a different already calculated cell (or self reference for that matter) you can use

=IIF(ReportItems!CellName.Value < 0,"Red","Green")

EDIT: This is actually listed in the link @Randall Mathews posted, which I didn't click until I answered.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM