Saturday, February 25, 2012

Conditional Format

I have a report that I would like to highlight some rows in it. I would have
to change the backgound color and set font to bold. The backgound color and
the flag to bold or not would be return by the stored procedure with the
data. For example:
'Gross Sales', 100, 'LightGrey', 'Bold'
'Net Sales', 80, '','' or 'Net Sales', 80, 'Transparent','Normal'
Is there a way to set formatting conditionally like that based on data
returned? Any help is appreciated.
Thanks,
Carmen.Hi Carmen
I assume that you are using a table to provide these rows. If you select
the row and click on the Background Color property, the top option is
'<expression>'. Selecting this takes you to a window that allows you to
access fields from your dataset.
something like '=Fields!BackgroundColor' entered here should do what you are
looking for, provided that your stored procedure returns a value that
definitely matches a color selection.
A similar thing can be done under the Font>FontWeight property for the row.
All the best,
Ed Allison
"Carmen" <Carmen@.discussions.microsoft.com> wrote in message
news:9BFFBF24-99D9-4D05-9C64-C4E0466337BC@.microsoft.com...
>I have a report that I would like to highlight some rows in it. I would
>have
> to change the backgound color and set font to bold. The backgound color
> and
> the flag to bold or not would be return by the stored procedure with the
> data. For example:
> 'Gross Sales', 100, 'LightGrey', 'Bold'
> 'Net Sales', 80, '','' or 'Net Sales', 80, 'Transparent','Normal'
> Is there a way to set formatting conditionally like that based on data
> returned? Any help is appreciated.
> Thanks,
> Carmen.|||They will not bind up automatically based on name... So in the Gross Sales,
background color expression you might place. (ie the query colum names
Select col, whatever, backcolor, fontweight from yourtable..)
=Fields!backcolor.Value
If the backcolor value might be empty you can provide a default value ie
=IIF(Fields!backcolor.Value is nothing,
'SomeDefaultColor',Fields!backcolor.Value)
(it would probably be better to provide a default back color in the query,
so it can be changed more easily than going into each expression tho.)
Hope this helps...
--
Wayne Snyder MCDBA, SQL Server MVP
Mariner, Charlotte, NC
I support the Professional Association for SQL Server ( PASS) and it''s
community of SQL Professionals.
"Carmen" wrote:
> I have a report that I would like to highlight some rows in it. I would have
> to change the backgound color and set font to bold. The backgound color and
> the flag to bold or not would be return by the stored procedure with the
> data. For example:
> 'Gross Sales', 100, 'LightGrey', 'Bold'
> 'Net Sales', 80, '','' or 'Net Sales', 80, 'Transparent','Normal'
> Is there a way to set formatting conditionally like that based on data
> returned? Any help is appreciated.
> Thanks,
> Carmen.|||Thanks Ed and Wayne for your responses. I decided to manually (in the report)
set backgound and bold since joining two queries on the report seemed a
little too complicated. However, I might use you guys suggestion in the
future.
Thanks again,
Carmen.
"Wayne Snyder" wrote:
> They will not bind up automatically based on name... So in the Gross Sales,
> background color expression you might place. (ie the query colum names
> Select col, whatever, backcolor, fontweight from yourtable..)
> =Fields!backcolor.Value
> If the backcolor value might be empty you can provide a default value ie
> =IIF(Fields!backcolor.Value is nothing,
> 'SomeDefaultColor',Fields!backcolor.Value)
> (it would probably be better to provide a default back color in the query,
> so it can be changed more easily than going into each expression tho.)
> Hope this helps...
> --
> Wayne Snyder MCDBA, SQL Server MVP
> Mariner, Charlotte, NC
> I support the Professional Association for SQL Server ( PASS) and it''s
> community of SQL Professionals.
>
> "Carmen" wrote:
> > I have a report that I would like to highlight some rows in it. I would have
> > to change the backgound color and set font to bold. The backgound color and
> > the flag to bold or not would be return by the stored procedure with the
> > data. For example:
> >
> > 'Gross Sales', 100, 'LightGrey', 'Bold'
> > 'Net Sales', 80, '','' or 'Net Sales', 80, 'Transparent','Normal'
> >
> > Is there a way to set formatting conditionally like that based on data
> > returned? Any help is appreciated.
> >
> > Thanks,
> >
> > Carmen.

No comments:

Post a Comment