Showing posts with label textbox. Show all posts
Showing posts with label textbox. Show all posts

Monday, March 19, 2012

Conditional sum based on visibility

Hi,

I have a report that is conditionally showing a textbox based on the previous entry that is working correctly.

My issue is that the non visible entries are still being added to my Sum statement at the end of the report.

I need a way to exclude an entry based on its visibility.

Any help would be greatly appreciated.

Are you using the Previous aggregate to get the previous entry? If you are not, then you can add a conditional, using the same expression for determining the visibility, to the SUM aggregate. For example, =SUM(IIF(HiddenExpression, 0, Fields!FieldName.Value))|||

Thanks for the response.

I am using the Previous function to control the visibility. The report needs to show the first entry for each particular company code, but not the duplicate entries.

For example: =Previous(Fields!Company_code.Value) = Fields!Company_code.Value

I tried adding a conditional with the same expression to determine if it should be included in the Sum, but that does not work.

Any other suggestions?

Thanks!

|||

Try handling it in the code (Report -> Report Properties -> Code)

Declare a public shared variable (integer/float) in the code and write a public function to sum up the values based on current company code and previous company code. Your code will look something like this in VB.Net:

Public Shared SumTotal as Integer

SumTotal = 0

Public Function CalculateSum(isCompanyCodeSame as Boolean, FieldValue as Integer) As String

If isCompanyCodeSame = False Then

SumTotal = SumTotal + FieldValue

End If

CalculateSum = ""

End Function

and

append this expression to any of the textboxes in your detail row:

Fields!FieldName.Value & Code.CalculateSum(Fields!Company_code.Value=Previous(Fields!Company_code.Value), Fields!FieldToBeSummed.Value)

And use Code.SumTotal to get the sum.

Shyam

|||

Thanks for the code!

It is working correctly now.

|||

I used the same method to stop displaying rows in a table after the 10th row. It works fine in VS 2005 but it acts wierd when I publish it to the production server. I count up the rows that are visible...

Public Shared VisibleRowTotal as Integer=0

Public Function CountVisibleRow(isVisible as Boolean) As String
If isVisible = False Then
VisibleRowTotal = VisibleRowTotal + 1
End If
CountVisibleRow = ""
End Function

Then I added a column in my report table to call the code...

=Code.CountVisibleRow(ReportItems!textbox54.Value) & " " & Code.VisibleRowTotal

Then I based my row visibility on the code value.

=IIF(Code.VisibleRowTotal>=10, True,False)

To get it to work the first time I had to rename the original report on the production server and then upload the new report. Once several users start hitting the report then no rows are visible or it's intermittent.

I'll admit I've have never used custom code in a report before. Is there something different I need to do when uploading an rdl with custom code? Am I handling the custom code properly?

|||
You should change the VisibleRowTotal variable to not be Shared. Having it be shared or static will cause each instance of the report to share the same total value. So, removing the modifier will allow each report instance to execute independently from one another.

Ian|||

Thanks Ian.

I had the issue where my totals were correct for the first time the report loaded, but the totals just kept incrementing when I used different filters on the report.

Taking Shared off of the variable resolved the issue.

Thursday, March 8, 2012

conditional look....

Hi;
is there a way to control the look of the printing based on the data?..
i want to change the look of a textbox in a table, based on the value in my
query, for example:
Job desc Name Income
Emply John 5000
Emply Peter 5000
Sup Hugo 5000
Emply Rich 5000
I want to change Font style to bold, when Job desc is Sup
Is there a way to do it?
TIAOn Apr 14, 10:09 am, "Willo" <willobe...@.yahoo.com.mx> wrote:
> Hi;
> is there a way to control the look of the printing based on the data?..
> i want to change the look of a textbox in a table, based on the value in my
> query, for example:
> Job desc Name Income
> Emply John 5000
> Emply Peter 5000
> Sup Hugo 5000
> Emply Rich 5000
> I want to change Font style to bold, when Job desc is Sup
> Is there a way to do it?
> TIA
Sure. While in the Layout view, select 'F4' (or the View tab and
Properties Window).Select the cell(s) in the table that you want to
change the font style for and in the Properties Window open up [+]
Font. To the right of 'Font Weight,' select the drop-down menu and
select '<Expression...>' and enter something like the following:
=iif(Fields!JobDesc.Value = "Sup", "Bold", "Normal")
Regards,
Enrique Martinez
Sr. Software Consultant

Wednesday, March 7, 2012

conditional formatting WITHIN textbox

Hi,
I have a report containing a table like this:
----
|=Fields!callRef.Value | ="Problem:" & Fields!callDesc.Value |
----
My boss wants me to make "Problem" bold while leaving the call description
(callDesc) in plain font.
--> Am I correct in thinking that this cannot be done?
My only solution is to do something like (add a new column):
----
|=Fields!callRef.Value | "Problem:" |= Fields!callDesc.Value |
----
Is there a better solution?
Cheers,
JoeSplitting these in to 2 text boxes are your only option as far as I know. I
have had to do that as well
Craig
"Joe Dillon" <JoeDillon@.discussions.microsoft.com> wrote in message
news:CA72895F-20A8-4963-B28B-94EAA9DB5185@.microsoft.com...
> Hi,
> I have a report containing a table like this:
> ----
> |=Fields!callRef.Value | ="Problem:" & Fields!callDesc.Value |
> ----
> My boss wants me to make "Problem" bold while leaving the call description
> (callDesc) in plain font.
> --> Am I correct in thinking that this cannot be done?
> My only solution is to do something like (add a new column):
> ----
> |=Fields!callRef.Value | "Problem:" |= Fields!callDesc.Value |
> ----
> Is there a better solution?
> Cheers,
> Joe|||You should be able to enter an expression into the format property
box...I have some stuff that shows a $ in a money column if its the
first or last row...like that or were you talking more about the font
and size?
--
Ben Sullins
http://bensullins.com|||Thanks for replies.
Craig - acutally my boss prefers it split so I am ok!
Sullins - yes I want to make the font bold
"sullins602" wrote:
> You should be able to enter an expression into the format property
> box...I have some stuff that shows a $ in a money column if its the
> first or last row...like that or were you talking more about the font
> and size?
> --
> Ben Sullins
> http://bensullins.com
>

Conditional Formatting - not so conditional?

I have the following code in the color property of a textbox. However, when I run my report all of the values in this column display in green regardless of their value.

=SWITCH(Fields!Wrap.Value >= 3, "Red", Fields!Wrap.Value < 3, "Green")

I already tried =iif(Fields!Wrap.Value >= 3 , "Red", "Green") and got the same results.

Is it because this is a matrix report? What am I doing wrong?

Thanks in advance . . .What part of the matrix do you have this in, and what values show in the textbox?|||OK, well you pointed me right to my problem. The values are percentages. I was doing my conditional formatting based on 3 instead of .03 . . .

That is fixed but I still have something else wrong. A very small number of values that are not .03 are coloring red. I am also getting a warning that says "[rsNonAggregateInMatrixCell] The Color expression for the textbox ‘textbox22’ references a field outside an aggregate function. Value expressions in matrix cells should be aggregates, to allow for subtotaling."

I assume this message is related to my problem.

Here is a sample of what the output is looking like. All of the values formatted correctly except for the 2.60 %. The 2.60% was colored red as if it was >= .03. I know you can't see the colors here:

WRAP

3.50 %

1.22 %

1.15 %

3.13 %

2.43 %

2.60 %

14.21 %

0.00 %

8.41 %

6.14 %

5.23 %

5.23 %

2.42 %

2.42 %

1.87 %

1.87 %

2.39 %

2.39 %

4.17 %

4.17 %

3.15 %

|||

A matrix cell is always in the intersection of a row and a column group. Usually, several detail rows will go into the same matrix cell instance based on the row/column grouping. That's the reason why you get the warning. By just referencing a field without aggregate function (=iif(Fields!Wrap.Value >= 0.03 , "Red", "Green") ), you reference just the field value of the first row in that cell - while the textbox in the cell may actually show the aggregate of the values.

You should use the following color expression instead: =iif(Sum(Fields!Wrap.Value) >= 0.03 , "Red", "Green")

-- Robert

|||I made the change that you suggested. Which eliminates the warning that I was receiving. However, I am still getting inconsistent results with the formatting. For instance, of the following values only 5.09, and the two 0.00's are colored green.

Could it be because I have enabled drill-down in this report? Even if I drill down to the lowest level the colors still are not consistently populating based on the conditions in this formula.

WRAP

5.09 %

2.73 %

0.00 %

0.00 %

1.77 %

2.55 %

3.61 %

6.68 %

3.02 %

3.50 %

2.86 %

Saturday, February 25, 2012

Conditional Count in RDLC Expression

I'd like to put a count in a textbox but only a count where a column
doesnt equal certain values. Here is what I tried:
=Count(Fields!ReportStatus.Value<>"MAILED" AND Fields!
ReportStatus.Value<>"PRINTED" AND Fields!ReportStatus<>"TRANSMIT")
Obviously this didn't work. Can anyone point me in the right
direction?
Thanks,
JasonOn Mar 14, 3:36=A0pm, Jason Wilson <wils...@.ausrad.com> wrote:
> I'd like to put a count in a textbox but only a count where a column
> doesnt equal certain values. =A0Here is what I tried:
> =3DCount(Fields!ReportStatus.Value<>"MAILED" AND Fields!
> ReportStatus.Value<>"PRINTED" AND Fields!ReportStatus<>"TRANSMIT")
> Obviously this didn't work. =A0Can anyone point me in the right
> direction?
> Thanks,
> Jason
See if this works:
=3DCOUNT(IIF(Fields!ReportStatus.Value<>"MAILED" AND Fields!
ReportStatus.Value<>"PRINTED" AND Fields!
ReportStatus.Value<>"TRANSMIT",1,0))
HTH
toolman|||On Mar 14, 3:36=A0pm, Jason Wilson <wils...@.ausrad.com> wrote:
> I'd like to put a count in a textbox but only a count where a column
> doesnt equal certain values. =A0Here is what I tried:
> =3DCount(Fields!ReportStatus.Value<>"MAILED" AND Fields!
> ReportStatus.Value<>"PRINTED" AND Fields!ReportStatus<>"TRANSMIT")
> Obviously this didn't work. =A0Can anyone point me in the right
> direction?
> Thanks,
> Jason
See if this works:
=3DSUM(IIF(Fields!ReportStatus.Value<>"MAILED" AND Fields!
ReportStatus.Value<>"PRINTED" AND Fields!
ReportStatus.Value<>"TRANSMIT",1,0))
HTH
toolman|||It did thanks