Showing posts with label cell. Show all posts
Showing posts with label cell. Show all posts

Monday, March 26, 2012

Proper Syntax of CASE() ion a cell in RS?

Hello All;
I was wondering if there is a way to make decisions on a particular cell in a
report (Tabular of Matrix) where the "CASE" effect can be achieved. I use IIF
(SOMEHTING >0,"RED","Green") all over, but I wonder if the decision making
can be expanded on Cell's content so as to get the Effect of CASE ot IF
ElseIF Else as follows:
If (SOMTHING) Then (DoSomething)
(ElseIF DOSomethingElse1)
(ElseIF DoSomethingElse2)
Else
(DoOtherwise)
Thank you.
--
Message posted via http://www.sqlmonster.comThe best way is to write some code and call it.
In Report properties go to the code page and enter a VisualBasic .Net
function eg:
Function SetColour(ByVal N As Double) As String
Select N
Case 0
Return "White"
Case >0
Return "Blue"
Case Else
Return "Red"
End Select
End Function
then call the function in your expression to set the colour of a cell eg:
=Code.SetColour( Fields!CurrencyAmount.Value-Sum(Fields!AmountExpensed.Value))
"James Woo via SQLMonster.com" wrote:
> Hello All;
> I was wondering if there is a way to make decisions on a particular cell in a
> report (Tabular of Matrix) where the "CASE" effect can be achieved. I use IIF
> (SOMEHTING >0,"RED","Green") all over, but I wonder if the decision making
> can be expanded on Cell's content so as to get the Effect of CASE ot IF
> ElseIF Else as follows:
> If (SOMTHING) Then (DoSomething)
> (ElseIF DOSomethingElse1)
> (ElseIF DoSomethingElse2)
> Else
> (DoOtherwise)
> Thank you.
> --
> Message posted via http://www.sqlmonster.com
>|||Mary .. Thank you :), very nice code.
--
Message posted via http://www.sqlmonster.com|||Based on the information below I have been able to create code, however I
need to test for a value between 2 numbers..ex
Case < 366
Return "1 yr or less"
Case >0 and <731
Return "1-2 years"
I am running into an issue with line 3. Is it possible? Am I using the
wrong syntax? If this is not the best approach what would that be?
Thank you for any guidance.
"Mary Bray [SQL Server MVP]" wrote:
> The best way is to write some code and call it.
> In Report properties go to the code page and enter a VisualBasic .Net
> function eg:
> Function SetColour(ByVal N As Double) As String
> Select N
> Case 0
> Return "White"
> Case >0
> Return "Blue"
> Case Else
> Return "Red"
> End Select
> End Function
> then call the function in your expression to set the colour of a cell eg:
> =Code.SetColour( Fields!CurrencyAmount.Value-Sum(Fields!AmountExpensed.Value))
> "James Woo via SQLMonster.com" wrote:
> > Hello All;
> >
> > I was wondering if there is a way to make decisions on a particular cell in a
> > report (Tabular of Matrix) where the "CASE" effect can be achieved. I use IIF
> > (SOMEHTING >0,"RED","Green") all over, but I wonder if the decision making
> > can be expanded on Cell's content so as to get the Effect of CASE ot IF
> > ElseIF Else as follows:
> > If (SOMTHING) Then (DoSomething)
> > (ElseIF DOSomethingElse1)
> > (ElseIF DoSomethingElse2)
> > Else
> > (DoOtherwise)
> > Thank you.
> >
> > --
> > Message posted via http://www.sqlmonster.com
> >|||I was able to find some information, this may helps others...
Case < 366
Return "1 yr or less"
Case 0 To 731
Return "1-2 years"
"DigitalVixen" wrote:
> Based on the information below I have been able to create code, however I
> need to test for a value between 2 numbers..ex
> Case < 366
> Return "1 yr or less"
> Case >0 and <731
> Return "1-2 years"
> I am running into an issue with line 3. Is it possible? Am I using the
> wrong syntax? If this is not the best approach what would that be?
> Thank you for any guidance.
> "Mary Bray [SQL Server MVP]" wrote:
> > The best way is to write some code and call it.
> > In Report properties go to the code page and enter a VisualBasic .Net
> > function eg:
> > Function SetColour(ByVal N As Double) As String
> > Select N
> > Case 0
> > Return "White"
> > Case >0
> > Return "Blue"
> > Case Else
> > Return "Red"
> > End Select
> > End Function
> >
> > then call the function in your expression to set the colour of a cell eg:
> >
> > =Code.SetColour( Fields!CurrencyAmount.Value-Sum(Fields!AmountExpensed.Value))
> >
> > "James Woo via SQLMonster.com" wrote:
> >
> > > Hello All;
> > >
> > > I was wondering if there is a way to make decisions on a particular cell in a
> > > report (Tabular of Matrix) where the "CASE" effect can be achieved. I use IIF
> > > (SOMEHTING >0,"RED","Green") all over, but I wonder if the decision making
> > > can be expanded on Cell's content so as to get the Effect of CASE ot IF
> > > ElseIF Else as follows:
> > > If (SOMTHING) Then (DoSomething)
> > > (ElseIF DOSomethingElse1)
> > > (ElseIF DoSomethingElse2)
> > > Else
> > > (DoOtherwise)
> > > Thank you.
> > >
> > > --
> > > Message posted via http://www.sqlmonster.com
> > >

Tuesday, March 20, 2012

Progress Bar in Table Cell

I'm creating a report with several columns. One of which is a percentage
value. The business people have asked that that column show a progress bar of
sorts to give a visual indicator of the percentage complete, in addition to
the textual %. I have tried to figure out how to do this in a table cell but
to no avail. It appears that you can't use an Expression to set the sizing of
an image, rectangle, etc. Anyone have an idea on how this might be done?
Thanks!you could try a chart (one of the bar graphs that are horizontal based).Then
maybe format the chart to remove the legend, scale, title etc
"rSmoke" wrote:
> I'm creating a report with several columns. One of which is a percentage
> value. The business people have asked that that column show a progress bar of
> sorts to give a visual indicator of the percentage complete, in addition to
> the textual %. I have tried to figure out how to do this in a table cell but
> to no avail. It appears that you can't use an Expression to set the sizing of
> an image, rectangle, etc. Anyone have an idea on how this might be done?
> Thanks!|||I had tried that, except you can't put a chart in a table cell. However, your
post led me to try a subreport with a chart in it. That works great. I had
tried a subreport before but hadn't thought to try a chart in it. Thanks for
the help.
"NH" wrote:
> you could try a chart (one of the bar graphs that are horizontal based).Then
> maybe format the chart to remove the legend, scale, title etc
> "rSmoke" wrote:
> > I'm creating a report with several columns. One of which is a percentage
> > value. The business people have asked that that column show a progress bar of
> > sorts to give a visual indicator of the percentage complete, in addition to
> > the textual %. I have tried to figure out how to do this in a table cell but
> > to no avail. It appears that you can't use an Expression to set the sizing of
> > an image, rectangle, etc. Anyone have an idea on how this might be done?
> > Thanks!|||Note: you can put a chart inside a table group header or group footer. In
that case, the chart would be based of all data rows of that particular
group instance (which is what you typically want). The subreport approach
works but is usually not as efficient as table groups.
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"rSmoke" <rSmoke@.discussions.microsoft.com> wrote in message
news:7CC6307F-077B-45A8-9BBD-18C451815AD4@.microsoft.com...
>I had tried that, except you can't put a chart in a table cell. However,
>your
> post led me to try a subreport with a chart in it. That works great. I had
> tried a subreport before but hadn't thought to try a chart in it. Thanks
> for
> the help.
> "NH" wrote:
>> you could try a chart (one of the bar graphs that are horizontal
>> based).Then
>> maybe format the chart to remove the legend, scale, title etc
>> "rSmoke" wrote:
>> > I'm creating a report with several columns. One of which is a
>> > percentage
>> > value. The business people have asked that that column show a progress
>> > bar of
>> > sorts to give a visual indicator of the percentage complete, in
>> > addition to
>> > the textual %. I have tried to figure out how to do this in a table
>> > cell but
>> > to no avail. It appears that you can't use an Expression to set the
>> > sizing of
>> > an image, rectangle, etc. Anyone have an idea on how this might be
>> > done?
>> > Thanks!