SSRS 2008 R2 expression to hide columns if it has NULLs
Hi, I am using SQL Server 2008 R2 and both ColA & ColB are of varchar(50) datatype. I am trying to hide these columns if they are nulls and interestingly I was able to hide ColA writing the below hidden expression
=IIF(Fields!ColA.Value = Nothing, True, False)
and for ColB the below expression seems to work
=IIF(Count(IsNothing(Fields!ColB.Value)) = Cint(0), True, False)
Just don't understand why?
Thanks in advance.....
Ione
Hi ione721,
According to your description, you want to know the expression for hiding columns and the how those two expressions works to hide a column based on the values of data fields. Right?
In this scenario, for the first expression, it supposed to be "=IIF(Fields!ColA.Value is Nothing,True,Flase)", when table generates a detail row which contains a null value for ColA, the expression meet the condition and return True.So the column will be
hidden. And it will stop judging with next detail row generated. In the second expression, the IsNothing() function returns a Boolean, no matter is True or Flase, they are both counted as 1. It can never be equal to 0 and always return false. So the second
expression will keep the column visible which is not correct.
If you have any question, please feel free to ask.
Best Regards,
Simon Hou
Similar Messages
-
Hello everyone...I am using web application.Can anybody tell me how to hide column if data is not present in it in RDLC table using nchar type of data.I have used expression for it but its not working As column is hided but if I insert some
value in that column then it should display value but it is not displaying,it hides column.Hi Sayali,
Is the issue same as raised in below thread? Try out the fix provided by Wendy Fu and also other expressions provided in there.
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/76bba7ad-e6a0-4b7b-b17d-885494439446/column-visibility-issue-in-ssrs2012?forum=sqlreportingservices
-Vaibhav Chaudhari -
SSRS 2008, have this report
Qty Column --------- Est cost column ----- Mark up Cost Column - Did add Total cost column
4 pcs- $ 2000.00 --------------$ 50.00 --------------- $ 2050.00
Avg Cost
$2050/4= 512.50
how to write this exp to get value $ 512.50
what I did , its not giving me correct result,
=Sum(Fields!estCOSTAMOUNT.Value+Fields!COSTMARKUP.Value)/(Fields!QTY.Value)
can some one please advise what I am doing wrong.
thanks in advanceI tried both exp, did not work
may be I was not clear in the question
Qty Column --------- Est cost column ----- Mark up Cost Column - Did add Total cost column
4 pcs- $ 2000.00 --------------$ 50.00 --------------- $ 2050.00
2 pcs ------------------$ 1500.00 --------------=$100.00 ----------------$1600.00
Total qty 6 pcs-----$ 3500.00------------------$150.00---------------$ 3650.00
Avg Cost
$3650..00/6= 608.33
my field name
=Sum(Fields!COSTAMOUNT.Value) + want to add cost amount and Mark up and divide with qty total
=Sum(Fields!COSTMARKUP.Value)
=Sum(Fields!QTY.Value)
please help how can I write it to get the result -
SSRS 2008 not returning correct dataset from Stored Procedure
Hi,
I have a stored proc which returns different no. of columns as output based on the input parameter. The issue I am facing is that the SSRS 2008 is always populating the column list of the dataset with the first select list irrespective of the input
parameter.
How can I have the SSRS populate the column list based on the input parameter I am passing?
eg.
IF @type
=
'test'
BEGIN
SELECT 1 AS Col1,2 AS Col2
END
ELSE
IF @type
=
'test1'
BEGIN
SELECT 1 AS Col1,2 AS Col2,3 AS Col3
END
SSRS always populates the dataset with two columns viz col1 & col2 even when I pass
'test1' as input parameter.
Thanks for the help in advance.
SherinFrom my experiences, your dataset must return the same number of column and same name in both select statement.
IF
@type =
'test'
BEGIN
SELECT 1 AS Col1,2 AS Col2,
null AS Col3
END
ELSE
IF @type
=
'test1'
BEGIN
SELECT 1 AS Col1,2 AS Col2,3 AS Col3
END -
SSRS 2008 R2 Column Graph, Scalar Axis, Columns Take more than 1 Category
In SSRS 2008 R2, I have created a stacked column graph with two data columns, using a scalar axis with dates. If I have two columns next to one another, everything is rendered fine. If all of my columns have space between them, then the columns
will take more than just the day that they fit.
Here is a pastebin
with a simplified report that exhibits the issue.
When I render the chart, this is what it looks like.
Whereas, I would expect something like this.Hi clcrutch,
After testing the issue in my own environment, I can reproduce it. Just as you said, if there are two columns next to each other, then all the columns will be displayed on their own location; if all the columns in the chart exist space between each other, then
they will expand as wide as possible until there is no place to display all columns. This is by design.
Besides, if in the second scenario, we can manually add one record in the dataset, and then hide the additional record in the chart to work around this issue. For more details, please see:
Add one new record with adjacent date of MyDate field and unique value of MyStackedValue field in the dataset as below:
INSERT INTO #Temp (ID, MyDate, MyStackedValue)
VALUES (100, '11/24/2013', 1000)
Right-click the series to open the Series Properties dialog box, select Visibility in the left pane.
Using the expression below to control the series Visibility:
=iif(Fields!MyStackedValue.Value="1000",true,false)
If you have any other questions, please feel free to ask.
Regards,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Hide column in SSRS is not working while exporting to CSV format.
Hi,
I have a report where some columns are hidden based on parameter value. When I export to Excel all the hidden columns are hiding which is fine, but the issue is when I exported to CSV all the hidden columns are exporting to csv.
I tried to using " =IIF(Globals!RenderFormat.Name = "CSV", True,False)" in Column visibility but It is not working. When I select Hide option it is working fine. But I want to hide based on expression.
Any help !!!!!!!!Hi sumancv,
In SQL Server Reporting Services (SSRS), we can control whether an item is visible in CSV separately from whether an item is visible in other renderers. As Shahfaisal Muhammed posted earlier, the CSV renderers use the DataElementOutput property to control
visibility. When an item has DataElementOutput=Output, it will appear in the CSV. When an item has DataElementOutput=NoOutput, it will not appear in CSV.
Based on my test, we cannot use expression to control column visibility in the report when it is export to CSV.
Reference:
http://connect.microsoft.com/SQLServer/feedback/details/742658/ssrs-csv-export-issue-for-hiding-certain-columns-using-expressions
Since the issue is by design, I recommend you that submit a wish to the Microsoft Connect at
https://connect.microsoft.com/SQLServer/Feedback. Your feedback is valuable for us to improve our products and increase the level of service provided.
Regards,
Alisa Tang
If you have any feedback on our support, please click
here.
Alisa Tang
TechNet Community Support -
SSRS 2008 - hide chart lines based on parameter selected
How to control visibility of chart lines based on Params selected by user?
By default, my report display last 3 years worth of data (including current) with Month on the x axis and Counts on the y axis. I have two Boolean parameters:
TwoYrs? T/F
ThreeYrs? T/F
if False is selected for TwoYr and ThreeYr parameters then I want to hide chart lines corresponding to last year and the year before.
What I've tried: Created 3 Series groups with filters. eg. YearSeries1 to return only current year data and applying an expression to display it if params TwoYrs and ThreeYrs = False. and so on for YearSeries2 to return current + last
years data if param TwoYrs is True and ThreeYrs = False. But I don't see where to add expression to control the display of the individual series groups. I am open to any way of doing this, but this seemed most logical.Hi Ok-Hee,
In your Source Query just need to filter the series data based on the Parameters.
I have written sample query below:-
select * from
select 1 monthnumber , 'Jan' MonthName, 2013 year,100 amount
union
select 1 monthnumber , 'Jan' MonthName, 2014 year ,200 amount
union
select 1 monthnumber , 'Jan' MonthName, 2015 year , 300 amount
union
select 2 monthnumber , 'Feb' MonthName, 2013 year, 300 amount
union
select 2 monthnumber , 'Feb' MonthName, 2014 year, 350 amount
union
select 2 monthnumber , 'Feb' MonthName, 2015 year,200 amount
union
select 3 monthnumber , 'Mar' MonthName, 2013 year, 380 amount
union
select 3 monthnumber , 'Mar' MonthName, 2014 year, 100 amount
union
select 3 monthnumber , 'Mar' MonthName, 2015 year, 500 amount
)t
where year in (
select distinct FilterYear from
select case when @TwoYrs=1 then year(getdate())-1 else year(getdate()) end FilterYear
union
select case when @TwoYrs=1 and @ThreeYrs =1 then year(getdate())-2 else year(getdate()) end FilterYear
union
select year(getdate()) FilterYear
) t
I have created one post in my blog , you can check the result.
https://msbitips.wordpress.com/2015/03/12/ssrs-2008-hide-chart-lines-based-on-parameter-selected/
Thanks
Prasad -
Ssrs 2008 r2 tablix is displaying when visibility is set to hide
In an SSRS 2008 r2 report, I have an existing report that if the grade level is from 01 to 03, one tablix is displayed. If the grade level > 03, the other tablix is displayed.
Now in the tablix for grade levels 01 through 03, I have placed several rectangles onto the tablix for better control of some new textboxes. I have set the property of some of the new textboxes so can not grow and can not shrink. I have not yet placed rectangles
onto the tablix for grade levels > 03.
Currently when I run the report for grade level 04, the tablix for grade levels 01 to 03 does not display. However there is a blank space on the SSRS report where grade levels 01 to 03 would display.
The tablix for grade level 04 does display.
Thus can you tell me what what to check on so the blank space for where tablix for grades 01 to 03 does not display when I want to generate the report for grade 04?Hi wendy,
Based on my research, if we directly hide a tablix, it would only hide the data but the tablix frame is remained. If we hide the tablix with expression, it would be hidden completely. This is by design. In your scenario, it seems that the tablix hide with
expression. So I guess maybe you are using a rectangle contain the tablix, and there are other items in the rectangle. Or there are some space between the tablix and the later items, so there are some blank space on the report when run the report for grade
level 04.
If there are any misunderstanding, please elaborate the issue for further investigation.
Thanks,
Katherine Xiong
If you have any feedback on our support, please click here.
Katherine Xiong
TechNet Community Support -
How to make a summary column appear only once (in the first page only) in SSRS 2008?
Hello Everyone,
How to make a summary column appear only once (in the first page only) in SSRS 2008?
Regards
Gautam S
RegardsHi,
Assuming you have test data like this ;
select 'abc'as [GROUP],'NN' name , 1 id
union all
select 'abc' as [GROUP] ,'PP' name , 1 id
union all
select 'abc'as [GROUP],'RR' name , 2 id
Step1 : take Tablix with row group as your group Name .
Step2 : right Click on Row Group Details -> Delete-> Delete Group Only
Step3 : In Count Cell use below expression ;
=CountDistinct(Fields!id.Value)
Follow this link;
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/b6b45917-0a26-4d15-be46-2c6a2697d6e9/distinct-rows-sum?forum=sqlreportingservices#5ffdee06-c2c8-44ea-a3a5-b958488bb6b5
Thanks
Please Mark This As Answer or vote for Helpful Post if this helps you to solve your question/problem. http://techequation.com -
How to calculate difference and percentage in matrix report dynamic columns in SSRS 2008
Hi Friends,
I need to calculate Difference and Percentage In matrix report SSRS 2008
1) Row grouping based On Product
2) Column Grouping Week and Fiscal Year Current week and Previous Year same Weeks
3)Data Invnetory(Value fileld)
Example:
If value1 and Value2 Available we need to calculate Percentage and Difference.Otherwise Not required NA I need to Show.
For example If Particular week,Current year data is available,Previous year week data is not available No
need to cal Diff and Percentage we need to show Empty.
Below Code is working for If two values is available.
If any one of the fiscal year week data is not there it's taking some garbage values.
I tries with If condition in GetPCT() and GetDiff() It's not working.
Can some one please help me on this.
I am using the custom code
Public Shared Value1 as String
Public Shared Value2 as String
Public Shared previous as string
Public Shared previousweek as string
Public Shared Function GetValue(Value as String,partner as String,Week as String) as String
If partner =previous and Week =previousweek Then
Value2=Value
Else
previous=partner
previousweek=Week
Value1=Value
End If
return Value
End Function
Public Shared Function GetDiff()
return Value2-Value1
End Function
Public Shared Function GetPct()
return (Value2-Value1)/Value1
End Function
How to handle this.
Thank You, Manasa.VHi veerapaneni,
According to your description, if one of the fiscal year week doesn’t have data, the custom code returns false results.
For your requirement, if NULL value exists in the database, we should replace it as zero then perform calculate. So within the code, we should judge whether the value is NULL. To achieve your goal, please refer to the steps below:
1. Create a table like below.
create table dif4
([Product Group] varchar(50),
[Week] varchar(50),
[Fiscalyearweek] varchar(50),
value int
insert into dif4 values
('Desktops','W01','FY14W01',0),
('Desktops','W01','FY15W01',45),
('Desktops','W02','FY14W02',null),
('Desktops','W02','FY15W02',30),
('Desktops','W03','FY14W03',12),
('Desktops','W03','FY15W03',50),
('Notebooks','W01','FY14W01',35),
('Notebooks','W01','FY15W01',56),
('Notebooks','W02','FY14W02',45),
('Notebooks','W02','FY15W02',87),
('Notebooks','W03','FY14W03',75),
('Notebooks','W03','FY15W03',105),
('Tablets','W01','FY14W01',34),
('Tablets','W01','FY15W01',46),
('Tablets','W02','FY14W02',49),
('Tablets','W02','FY15W02',96),
('Tablets','W03','FY14W03',42),
('Tablets','W03','FY15W03',113)
2. Add the custom code in the Report Properties.
Public Shared Value1 as Integer
Public Shared Value2 as Integer
Public Shared previous as string
Public Shared previousweek as string
Public Shared Function GetValue(Value as Integer,product as String,Week as String) as Integer
If Value=Nothing Then
Value=0
End If
If product =previous and Week =previousweek Then
Value2=Value
Else
previous=product
previousweek=Week
Value1=Value
End If
return Value
End Function
Public Shared Function GetPct()
If Value1=0 Then
return 0
Else
return (Value2-Value1)/Value1
End If
End Function
Public Shared Function GetDiff()
return Value2-Value1
End Function
3. Design the matrix like below.
4. Then get the expected results.<o:p></o:p>
If you have any question, please feel free to ask.
Best regards,
Qiuyun Yu
Qiuyun Yu
TechNet Community Support -
SSRS 2008 Hide (+)/ (-) sign for collapse/ expand
Hi everyone,
I have report based on a cube and I have 5 level hierarchy which is expandable/ collapsable. However in the resultset there is data like:
hier1
hier1 hier2
hier1 hier2 hier3 hier4
etc.
This is causing the report to expand empty hierarchy name line and in this case I would like to hide the expand/ collapse sign. I have played around with toggle before and I can make a certain level expanded or collapsed - I can not hide the sign (+/-).
Any help on this will be very much appreciated
Thank you in advance,
MariHi Maria,
I wrote a solution for hide the (+)/ (-) sign if the group has no children data in Reporting Services 2005, and it also available for 2008. Create an additional column next to the group header, set toggled item to be the cell in new column not the group header. After that, hide the additional column conditional =iif(Fields!details.Value is nothing,true,false)”. In this way, if there is no children data, you cannot see the additional column then you cannot expand the details.
For more information, see:
http://social.msdn.microsoft.com/forums/en-US/sqlreportingservices/thread/563e6d9e-c824-4719-933e-37306a3b652f
Hope this helps.
Raymond -
SSRS 2008 Gauge ToolTips - expression does not work?
Hi,
I'm attempting to use various SSRS 2008 gauges in a report. When I attempt to use an expression in a tooltip such as '=Sum(Fields!ID.Value)' , the tooltip does not show up.
However if I replace that expression with a static value such as '1' it pops up.
It seems that an expression should work? Any reason that it would not?
ThanksHi,
I could reproduce the scenario you posted.
It is caused that string type is required for the
ToolTip property of the Gauge Pointer. So, please change the expression to
=CStr(Sum(Fields!ID.Value)).
If you have any question, please feel free to ask.
Thanks,
Tony Chain
Tony Chain [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help. -
Ssrs 2008 r2 textbox expression
In an SSRS 2008 R2 existing report, I wouuld like a particular textbox to look like the following when there is data:
Checking: $57.35
In the same textbox when there is no amount, the textbox would look like the following:
Checking: $0.00
The following iif statement gets the dollar amount want to display:
=IIF(Fields!PaymentType.Value="Checking", sum(cdec(Fields!TransactionAmount.Value)),0)
However I would like to know how to write an iif statement that would include the wording
"Checking: " with the dollar amont that needs to be displayed.
I have tried concatentations that I can think of, but when the report runs, I get the #error in the location
I would like to see the wording "Checking:' with the dollar amount.
Thus can you show me an expression that would solve my problem?Hi,
I think you have a field "Fields!TransactionAmount.Value" which have amount and you want to display it with word "checking" so for this you need to use IIF function as:
=IIF(Fields!PaymentType.Value="Checking", "Checking: "+str(sum(cdec(Fields!TransactionAmount.Value))),
"Others: "+str(sum(cdec(Fields!TransactionAmount.Value))))
I hope this will work.
Thanks
Avanish
Live life with joy and happiness! Avanish -
Hi,
I am using SSRS 2008 R2.
I have two TABLIX in a report. One is TABLIX with row/clumn grouping. 2nd one is flat view.
Here each tablix is dispaly it's data on single page for each.
My Requirement on First TABLIX is:
1. I have to make column headers visible on scrolling down
2. Export to PDF - column headers must be visible on all the pdf pages for same tablix data.
But ... either one is achieved at my end.
so ... any suggestions please to achieve both at same time.
thank you in advance.
best regards,
venkat.Hi G.V.Naidu,
According to your description, the first tablix is matrix to use display data.
In SSRS, if we want to fix matrix header visible while scrolling and repeat header columns on each page, we can select the corresponding option to enable this function. Please refer to the steps below:
1. Right click tablix, and select Tablix Properties.
2. Select “Keep header visible while scrolling” and “Repeat header rows on each page” to enable these function.
If we are use table to display data, please refer to the article about Repeat Header / Keep Header Visible in Tables.
http://blogs.msdn.com/b/robertbruckner/archive/2008/10/13/repeat-header-and-visible-fixed-header-table.aspx
If there are any misunderstanding, please feel free to let me know.
Regards,
Alisa Tang
Alisa Tang
TechNet Community Support -
How to Update the oracle toad column value in table by using SSRS 2008
Hi Team,
How to update the oracle DB table column value by using SSRS 2008.
Can any one help me on this.
Thanks,
Manasa.
Thank You, Manasa.VHi veerapaneni,
According to your description, you want to use SSRS to update data in database table. Right?
Though Reporting Services is mostly used for rendering data, your requirement is still can be achieved technically. You need to create a really complicated stored procedure. Pass insert/delete/update and the columns we need to insert/delete/update as
parameters into the stored procedure. When we click "View Report", the stored procedure will execute so that we can execute insert/delete/update inside of the stored procedure. Please take a reference to two related articles below:
Update Tables with Reporting Services – T-SQL Tuesday #005
SQL Server: Using SQL Server Reporting Services to Manage Data
If you have any question, please feel free to ask.
Best Regards,
Simon Hou
Maybe you are looking for
-
I've recently uploaded a new website and am having a glitch with internet explorer with the vertical spry menu. It appears perfectly in all other browsers. I had added css rules to move up some of the longer submenus so they would all appear on the s
-
T.Code for checking the total value of a material
Hi Experts, Can anybody tel me the T.code for checking the total value of a material which is procured in a specified period? Thanks in advance Channa
-
Senior Test Automation Engineer LabView Perm Position in San Diego
Senior Hardware Test Automation Engineer- LabView Company is, headquartered in San Diego, California, is focused on developing technology for the continuous monitoring of glucose in people with diabetes. Company is committed to developing technologi
-
How to calculate number of threads running on Windows 2000 terminal?
How to calculate number of threads running on Windows 2000 terminal for the oracle process? I have installed Oracle 9i DataBase with 6 patch(9.2.0.6.0) on Windows 2000 Terminal. But,after database is started up, when i check up the sessions in v$sess
-
App Store.... Please help
I opened my App Store on my ipad and a game I neither want or care about is open asking me to buy it. I can open the information and read it so it's not frozen it just won't let me close it please help annoyed x