SSRS Tablix filter parameter - ssrs-2008

I have a multi select parameter called unit with 3 values 15,16,17. I need to use these 3 values to filter 3 tables according to which unit was selected.
I was trying for the table's filter:
Expression: =Parameters!Units.Value
Operator: =
Value:
=Parameters!Units.Value(0) --for the 1st table
=Parameters!Units.Value(1) --for the 2nd table
=Parameters!Units.Value(2) --for the 3rd table
However this always give me an error. It seemed the Expression part never work. Please help thanks!

Related

Filter on Group Expression using lookup to second dataset. SSRS 2012

I have two datasets (one is a stored procedure written by a vendor that cannot change). Stored procedure is the main dataset. I am using a second data set to bring back filtered results. The second dataset contains already filtered records.
Trying to use the Tablix filter:
=Lookup (Fields!UserGUID.Value,Fields!UserGUID.Value,Fields!MembershipPolicyGUID.Value, "Dataset2")
I have a group that needs to display only the records in Dataset2.
Dataset2 is written using a where statement only displaying
MembershipPolicyGUID not in'00000000-0000-0000-0000-000000000000' and '29976BA0-E2D7-494E-A1CE-20E609C76929' (these numbers are stored as text)
I need help in how to filter the records.
I have tried the <> in the Tablix filter using the above expression, but it does not work or rather it does not return any records from Dataset2 except those from Dataset1.
Figured it out. The filter should be:
expression =Lookup (Fields!UserGUID.Value,Fields!UserGUID.Value,Fields!MembershipPolicyGUID.Value, "Dataset2")
then operator >
then value 0

Generate table report using sql joins in iReport

SELECT a.CIVIL_ID,a.PAT_NAME,a.SEX,a.PAT_NAT_CD,a.BIRTH_DT,a.ADDR,a.MOBILE_NO,b.FILE_NO,b.CREATED_DATE
FROM PAT_MST a
JOIN PATIENT_FILE b ON (a.PATIENT_ID = b.PATIENT_ID)
AND( b.HOSP_DEPT_SEC_SERIAL = $P{P_HOSP_DEPT_SEC_CD})
AND a.SEX = DECODE($P{P_GENDER},'ALL',a.SEX,$P{P_GENDER})
AND TRUNC(B.CREATED_DATE)>= TO_DATE($P{P_FILE_CR_DT_FROM},'DD/MM/RRRR') AND TRUNC(B.CREATED_DATE) <= TO_DATE($P{P_FILE_CR_DT_TO},'DD/MM/RRRR')
I am using this query to generate a table report in iReport(5.6.0), but for some reason I am only getting the column headers but this query is returning records when I run on toad.
Please tell where I am wrong..
Are you using Table report element? If so, you are using not the main dataset but some other subdataset. You should transfer parameters values from the main dataset to the one of which your table "feeds".
Add to your subdataset a parameter for an every parameter, used in main dataset.
Right click on your table Edit table dtasource->select Parameters tab->click Add.
In the Add/modify parameter window select your subdataset parameters in the upper menu. In the lower menu select their values (correspondent parameter from main dataset). Do this for an every parameter.

I need to know if it is possible to create a SSRS report as defined

I have a query with 3 parameters that a user should be able to define:
AND (ORION_SCHED.TRIP.DATE_TIME = '09/11/2012')
AND (ORION.CUST.COUNTRY = 'BE')
AND (ORION_SCHED.TRIP.ID_SHIFT ='1')
DATE_TIME should be a datepicker
COUNTRY dropdown with defined values
ID_SHIFT dropdown with defined values
I guess this isn't an issue?
The result of this query will return the dataset
My actual question: I want the result to be presented in this way
So always 3 blocks of data next to each other, the data of every block is the result of the query filtered down on the column TRUCK_ID (a sub-select of the returned dataset)
The empty cells per block are a nice to have, these are non-unique values per TRUCK_ID that I don't wish to be repeated on every line, but like I said a nice to have.
I would add a new column to the query that returned 1,2 or 3 (for each different TRUCK_ID. Then I would use 3 Tablix (one per column on your report) and filter the data by the new column you added on the query.
Then you just group on the TruckID on each tablix and play around with the format. It should work.

Japerreport/ireport how to pass parameter from main report to dataset

I have a problem to pass parameter to dataset. My report is following:
MAIN REPORT query:
select distinct id_satellite from report.t_tmp_report_param where id_session = $P{id_session} order by id_satellite
(id_satellite is integer)
this query extracts at least two values: (i.e.) 3 and 4. I need these values to build details band (in this case 2 bands).
DATASET query:
select cn0 as x, elevation as y from mytable where id_satellite = ????
I should replace the question marks with the value extracted from MAIN REPORT query, and so before 3 and after 4.
How can I fix this problem?
Thanks for reply. My problem is on XY Line Chart, because, jasper builds two detail band, but in the two graphs, there is only one satellite (last satellite, in my example=4). I have in detail band a table too. The values on table are correct. It's very strange...
I've only tried it with subreports. But this article describes the solution to your question.

Get 2nd Value in Dataset in Reporting Services

This seems to be a very simple question, but I am trying to get the 2nd value in a dataset to display as a matrix's header value.
In this report, lets say that I have 2 datasets. In Dataset1, I have a query that pulls down 3 values for a parameter dropdown selection. In Dataset2, I return a result set and have bound it to my matrix.
Within the matrix, I have my repeating columns, and then 3 additional grouped columns to the right that have aggrigate values that I want to display. On the header of those 3 columns, I want to display the 3 values displayed in my Parameters dataset. Within the context of the matrix (and its dataset), I can get the first and last values of a different dataset (Dataset1 in this case) by using:
=First(Fields!DateDisplay.Value, "Dataset1")
=Last(Fields!DateDisplay.Value, "Dataset1")
I need to get something like:
=Second(Fields!DateDisplay.Value, "Dataset1")
How do I pull this off without violating the scoping rules on aggregate columns?
For SSRS 2008 R2, you can do this if each row of your dataset has an identifier column by using the LookUp() function.
=LookUp(1,Fields!Row.Value,Fields!DateDisplay.Value,”Dataset1”)
=LookUp(2,Fields!Row.Value,Fields!DateDisplay.Value,”Dataset1”)
=LookUp(3,Fields!Row.Value,Fields!DateDisplay.Value,”Dataset1”)
If you do not have an identifier column you can use ROW_NUMBER() to build one in.
Query:
SELECT ROW_NUMBER() OVER(ORDER BY DateDisplay) AS Row, DateDisplay
FROM Dates
Results:
Row DateDisplay
--- ---------
1 June 1st
2 March 12th
3 November 15th
Here is a link to a similar thread in MSDN Forums: Nth row element in a dataset SSRS
If you are using SSRS-2012 or 2014 then one has to use below expression.
=LookUp(AnyRowNumber, Fields!RowNumber.Value,Fields!DisplayField.Value,”DatasetName”)
I have tried above it was not working in my case.