SSRS no data in report - ssrs-2008

I have a single tablix on the SSRS report which fetches data from a stored procedure.
I am trying to show a meesage to the User when no data is present say, "** There is no data for this report*". I can do this easily by specifying this message in the **NoRowsMessage property of the tablix. But I want to show the headers of the tablix along with this message.
If I don't set the NoRowsMessage property, I get the headers but no message, but if I do, I get the message but no headers.
I need some help with this.
Note: I am using SSRS 2008.
Edit:
I can also put up a textbox with the relevant text message below the tablix and set it visible only if the tablix contains no rows. But I am not able to figure out as to how do I find out from the Visibility expression of the textbox whether the tablix contains any rows or not.

A tablix object is related to the underlying dataset, so if there's no data, there's no table in the output.
Other than using the NowRowsMessage property, the only other way I can think of to enforce this would be to ensure your query returns an empty value placeholder when there are now rows returned. This way you would have, in essence, a single data row.
You could then try and add a conditional expression on the table (i.e. on the Visibility property of the details row) to prevent any rows containing your placeholder from showing up.
So in your query you could have:
IF (##ROWCOUNT= 0)
BEGIN
SELECT
'[IAMEMPTY]' as [Col1]
,'[IAMEMPTY]' as [Col2]
,'[IAMEMPTY]' as [Col3]
END
And then in the Visibility property of your table's detail row:
=Iif(Fields!Col1.Value = "[IAMEMPTY]",True,False)
EDIT: Alternatively, to check if the DataSet is empty in SSRS and show a rectangle containing your message/headers (as mentioned in TooSik's comment), you could set up a rectangle with this in the Visibility expression:
=Iif(Rownumber("Dataset_Name")=0, False,True)

Related

jasper report show count on footer of a specific query

am very new to jasper report
also I have tried looking at videos but can not seem to get this one concept
basically there is this main query which i have
select * from table
which is populated in the details area
however i want a second query
select count(*) from table where name = "tim"
and put the count on the footer
can this be done using jasper
any tutorial to this concept or guidance would be helpful
to sum up the details area should show all the data where as the footer should only show counts of a few things.
You can only have one DataSet (therefore query) for the report. In your case this is your main report select * from table, which seems to be working well.
You have two options for adding the information you want:
(and I would say the better option) is to add a variable $V{tim_count} which is configured as:
initial value 0
expression value "tim".equals($F{name}) ? 1 : 0"
calculation function sum
there are multiple ways to increment this variable, so I'll leave that with you. In the footer you would then add a text field with the $V{tim_count} variable as it's contents.
You can read about variables here https://community.jaspersoft.com/wiki/variables
You can add an object that has it's own DataSet:
Table
List
Subreport
You would then be able to add your query to that object and display it appropriately. As you can see, displaying a COUNT is not really the most appropriate way to do this.
Note - I don't suggest this way

SSRS cannot linked text box with field

I group my table by 3 attributes, and set page break on every group, and now i want to display that three attribute outside the table. I want to place them on the top of the report, and when i type the expression and i go in run view it's display only the first value, when i go to the next page nothing change
I tried to drag field from table, from data set, and nothing working.
In expression i type
=Fields!My_Field.Value.
Also if some of that three attributes i placed in table it normally displays values, but when i try to move it somewhere it stops displaying.
The issue is that a table is associated with a dataset but a text box is not.
You can reference a field from a text box using the Dataset field ( =Sum(Fields!AMOUNT.Value, "Dataset1") ) but you need to use an aggregate function like First, Last, or SUM.
It sounds like you don't want to use an aggregate since you are grouping by these fields, though.
display the three attribute outside the table
If your trying to display the current grouping in the table at the top of each page, add a new Row in your matrix above your header row and add your group fields there.

JasperReports / iReport Designer: Can i show a band conditionally?

I have created a report as follow:
Multiple detail band
each detail band contains 1 table. Each table is linked to 1 dataset.
Can I hide the detail band whenever the result set of the query returns Empty set (no result found)?
how can I achieve this?
In the "Properties" of each Detail band you have an option called "Print When Expression" there you can place logic that evaluates to boolean.
When you fill it with your logic and it returns true this detail band is printed.
So, you will need to have the information if the table will be filled in advance and cannot address the dataset within.
If your datasets are too different to do this, you should overwrite the Dataset for the main report with a custom one that gathers the information and sets the fields appropriately.

Hide space between elements of a report

I have one report with various subreports. These subreports are within a table cell. When the subreport doesn't have any data available, I hide the components (tables, textbox, charts) in that subreport. However, this creates some blank space and I need to eliminate this space.
I already used the properties ConsumeContainerWhiteSpace and KeepTogether, but the blank space is still there.
Any suggestions to remove the blank space?
To hide or show an entire row based on another reports results will be difficult, if not impossible. You will need to get this data in your parent report somehow.
I would create a cut down version of your subreport's query that returns row count for every subreport, but within the parent report. Might look like this:
UserID RecordCount
Abby 3
Bob 0
Carl 1
If you are using SSRS 2008r2 you can then use a lookup function to set row visibility. For example the row visibility expression might be
=IIF(Lookup(Fields!UserID.Value,
Fields!UserID.Value,
Fields!RecordCount.Value,
"LookupDatasetName") > 0,
false,
true)
If an earlier version of SSRS, then join that dataset into the dataset for your table.

MS Access 2003 - Listbox formatting control

Just some general formatting questions about return records to a list box on a form:
I have a list box that returns sets of records based on SQL statement in VB. I need the SQl statement to return the ID (auto number) of each record, because if the user selects from this list box, I need the ID as a pass parameter to the next form. But I do not need the ID to show up in the actual list....anyway i can hide this, or just not display it?
I used rowsource like this:
me.searchlist.rowsource = "SELECT TblMain.MainID, TblMain.First, TblMain.MiddleTblMain.Last FROM TblMain ORDER BY TblMain.Last, TblMain.First DESC;"
Also the listbox has no headers, which i want, and has three columns for above example...but each column is way too big, can i control the width size of each column area inside the listbox? I tried the properties window, but that only seems to effect the first column and not all of them.
For the Header, the Listbox has a
property called Column Heads
(default no). Set this to Yes.
For the column widths, the Listbox
has a property for Column Count and
Column Widths. In your case you can set Column Count to 3 and Column
Widths to something like 0;2;3