Cant remove the decimal places in textbox SSRS - sql-server-2008

I'm working with SSRS Report that display the grades of Students. I need to display the grades which are already rounded to the nearest integer and I'm ok with that. But I'm wondering why the decimal places still appears even if the grades is already rounded and I already set the textbox properties to 0 decimal places. I've notice that it was started when I used cast. What is the problem? I need to cast the grades because of my condition. Please see below sql syntax and images.
I used MSSQL Server 2008 and Report Builder 3.0 r2
Here's my sql syntax in getting the grades of student
,(CASE
when dtl.STUDENT_GRADE < 1 or dtl.STUDENT_GRADE is null Then '-' Else
CAST(dtl.STUDENT_GRADE AS nvarchar(20))end) as GRADE
This is the report looks like and my settings in text box . Please see image

Try setting the Category to "Custom" and then set "Custom format" to N0

I found a solution to my problem, Since the cast gives me an issue with the decimal places, I changed the condition to set the grades of student to 0 if the grades is NULL or less than 1. Then I set the text box properties to show (-) if the value is 0.
Thanks for all your help it gives me an idea to solve my problem.

Related

SSRS currency format

I have great difficulty getting the last finished on the report im building. It has to show a value, a currency value. the only problem, which is a small one, is that the report builder is showing a ',' as a 1000 seperator but i need it to show a '.' instead, for example:
right now it shows:
12,345,678.00
i need it to show:
12.345.678,00
I have read a lot of questions in here and tried out this code:
= (new Decimal(11123.55)).ToString("€#,0.00;(€#,0.00)",
new System.Globalization.CultureInfo("es-ES"))
But that aint working as well, then it outputs this in the report:
€11853724112355
I am all out of ideas now.
Thank you in advance
You should leave the value of the cell as numeric because this is better in certain instances, for example, exporting to Excel. Generally, data and presentation should be separated.
Your report probably has the Language property set to en-US. Set it to es-ES and set the Format property of the cell to C and it should display properly.

Sum Values from Dataset based on condition: Report Builder

I have a report where users can select items from various location. And I have 3 datasets performing calculations where the third dataset takes the sum where item number is 4942200 and then calculates the values (as shown below):
=SUM(IIf(Fields!masterno.Value= "4942200",Fields!Owned.Value,0))+SUM(IIf(Fields!masterno.Value= "4942200",Fields!Subbed.Value,0))
This is returning error for some reason. The subbed column is toggled based on parameter (visibility). But before I add the toggle functionality, I want to make sure this is working. Can anyone help. I have also tried:
=SUM(IIf(Fields!masterno.Value= "4942200",Fields!Owned.Value+Fields!Subbed.Value,0))
This seems to fail as well. Help would be greatly appreciated.
I would wrap a CDec around Owned, 0 and Subbed, e.g.
=SUM(IIf(Fields!masterno.Value= "4942200",CDec ( Fields!Owned.Value) ,CDec (0 ) ))+SUM(IIf(Fields!masterno.Value= "4942200",CDec (Fields!Subbed.Value ) ,CDec ( 0 )))
If Owned and Subbed are already Decimals, those CDec's may be redundant. On the other hand SSRS doesnt expose this info and they can change at the whim of the data source.

Type Problems with Filter Expression in SSRS

SQL Server 2008 R2, using BIDS to design the report.
I have a table and I am trying to only show a certain row. Maybe there are better ways to do this, but I am coming across an error with the filter expression and regardless of how I achieve my initial task, I'd like to understand the filtering.
I started with the filter expression (set to type "Integer"):
RowNumber(Nothing) = 1
This gave the error:
Cannot compare data of types System.String and System.Int32.
I found the solution to this is to change the 1 to "=1" as 1 is evaluated as a string.
So I then had:
RowNumber(Nothing) = =1
That changed nothing, I got the same error.
Then I tried to do that to the first part of the expression:
=RowNumber(Nothing) = =1
This changed the error to a deployment problem (still builds, which is frustrating):
Error pvInvalidDefinition : The definition of the report '/ReportName' is invalid.
I then tried using CInt on RowNumber:
CInt(RowNumber(Nothing) = =1
Then I can deploy it, but the error just changes back to the first one:
Cannot compare data of types System.String and System.Int32.
It seems no matter what I try here I either can't deploy the report or I get an error that I'm comparing a string to an int.
RowNumber returns an integer, so it seems like this should work. I've tried using the name of the dataset in place of "Nothing" but that doesn't change what I'm seeing.
I realize there are many ways to solve my initial problem, but I am curious as to why the filter expression is invalid.
Its better to hide a row with visibilty property. Just click on any text box and go to visibily tab . You can now click on show or hode and go to expression.
That default to Hide . So write an expression there to hide the row.
=IIf(NOT(RowNumber = 1),TRUE,FALSE)
Let me know if you get any error
RowNumber is not available to use in a Tablix Filter.
Using RowNumber(Nothing) <> 1 as a Row visibility property fixed the issue.
Using BIDS you are not given any error that indicates what the problem is, but importing the report to Report Builder and deploying it from there will give a more descriptive error that, in the end, helped me to solve my problem.

Cant get 'Show zero as' to work in Report Builder 3.0

I have a report containing a tablix. Some of the fields in the tablix contain no value upon report creation. I want to show '0.00' as a default in these fields.
I have looked at textbox properties > Number > "Show zero as" but no matter what I cant get them to show.
I have to admit that I'm a SSRS newbie so I might have overlooked something. I googled a bit around and found something about IF statements in the expression, but cant quite figure it out.
The table data in the tablix is floating-point numbers.
Any advice is much appreciated.
The problem sounds like they are Null, not zero. Try using an expression like this:
=IIF(IsNothing(Fields!MyField.Value), 0, Fields!MyField.Value)
So when it is nothing (that is, Null), you get zero, otherwise you get the field value.
You should change the SQL if possible otherwise Chris Latta's answer is best.
For example if you use oracle you should use the nvl(v1, 0) function, or the isnull(v1, 0) for MS SQL. Keeping it in the query will reduce required processing.
I had to use the literal value of zero to get this to work.
=IIf(Sum(Fields!NewCount.Value) = 0, "0", Sum(Fields!NewCount.Value))
add zero to the expression:
=Sum(Fields!NewCount.Value) + 0

SQL 2008 Reporting Services Question - tablix visable

I have a report that has two tablix on it. I'm trying to control the visibility of the tablix using an expression. When i hard code in a boolean value of 0 or 1 the visibilty works. When i put in something like the following
=cbool(iif(First(Fields!bGeneralQuestionDisplayed.Value, "ClassificationNarrowed")=1 ,1,0))
it does not work. I've profiler to verify that the query is running and returning the results. I've also created a text field on the form rumming the same expression.. the result is a 1 or a 0.
anyone have any idea as to what might be causing the issue.
thanks
shannon
According to the FIRST documentation, the second parameter represents a group. Do you have a "ClassificationNarrowed" group defined?