How to pass multiple values to drilldown report? - reporting-services

I m using sql 2008. I have one matrix on the report. Data will be as follow
Maths English Science
Gender 5 3 4
Male 1 2 2
Female 4 1 2
Count shows the number of students passed in respective subjects.Data is grouped by gender When user click on count it will be redirect to sub report. Now i want to pass Students Ids to sub report to show that students only. I have tried Join, Split but those functions can be used with parameters only. Not with Fields. Basically i want to pass string of comma separated students ids to sub report.
I have searched on Google but not finding any solution. So awaiting for solution.

I've done this recently by setting a click action in a tablix control. Essentially, I went to the Text Box Properties I went to Action and then set the action as Go to URL. I've then put an expression in for the following (which you can modify to your needs depending on the destination report name and parameters):
=IIf(
Parameters!p_hide_links.Value="y",
Nothing,
"javascript: void( window.open('http://' + window.location.host + '/ReportServer/Pages/ReportViewer.aspx?/Property+Management/" & replace(Parameters!i_this_report.Value, " ", "+") &
"&p_from_date=" & Parameters!p_from_date.Value &
"&p_to_date=" & Parameters!p_to_date.Value &
"&p_lease_exec=" & Fields!submitted_by.Value &
"&p_building_state=" & Parameters!p_building_state.Value &
"&p_division_id=" & Parameters!p_division_id.Value &
"&p_building_id=" & Parameters!p_building_id.Value &
"&p_view_type=d" &
"') );"
)

This might be the answer you are looking for:
Right Click on any text box select TextBox Properties and do as in below jpg.
Now select the detail report from the drop down [create new if its not there]
pass the parameters whichever you wanted to and this will be like input parameter to this sub report and using any details dataset you can show on the report view.
Let me know if you face any problems in that.

Related

Combining Access Reports

I have a created two access reports. One is a summary report and the other provides greater detail. There is a common field for each. The summary report is always 1 page printed portrait. The detail report is always printed landscape and can be 1 or more pages. Currently i need to print each report separately and manually match by the common field (employer number). The print sort is also differs for both. The summary report has a sequence number. The detail report does not and uses the employer number as the sort index.
What i would like to figure out is the ability to print these reports out together. Summary report and then its related detail report... Summary report and its detail report, etc.
Basically you need a VBA procedure that will open a recordset to allow you to loop through the employee numbers. The main part of the procedure will look something like this:
Set rsEmployees = CurrentDb.OpenRecordset "select EmpNo from Employees order by EmpNo"
Do While Not rsEmployees.EOF
'Print summary report for this employee
'Print detailed report for this employee
rsEmployees.MoveNext
Loop
Replace the two commented lines with commands to print the two reports. Depending on whether your EmpNo is numeric or text, these commands will look like either
docmd.OpenReport "MainReport", acViewNormal, , "EmpNo = " & rsEmployees(0)
or
docmd.OpenReport "MainReport", acViewNormal, , "EmpNo = '" & rsEmployees(0) & "'"
Hope this helps.

Adding values to a Report when there is no Data in query SSRS for both Datasets

The intro for this little problem starts here:
Adding values to a Report when there is no Data in query SSRS
After that:
Adding values to a Report when there is no Data in query SSRS Between Datasets
Now a basic introduction of what Im trying to accomplish.
With this expression:
=IIF(IsNothing(Lookup(Trim(Fields!total_Cod_vendedor.Value) & "-" & ReportItems!G2.Value, Fields!AgregarMost.Value, Fields!most_atados.Value, "EfectividadDeFrecuencias_Most")) = True, "0", Lookup(Trim(Fields!total_Cod_vendedor.Value) & "-" & ReportItems!G2.Value, Fields!AgregarMost.Value, Fields!most_atados.Value, "EfectividadDeFrecuencias_Most"))
What I'm doing is check if the combination of a Somefield.Value-reportitemName.Value exists on the other Dataset where said content is saved in a calculated field inside that other Dataset. When the IsNothing is true, then put a "0" if not, "Dosomething" which in this case it doesn't matter.
So the idea was to put 0 each time it doesn't exist that combination for the Dataset Im right now.
Now, the idea is to do the same but when the other Dataset does not have values.
Imagine my tablix have "Dataset" where in a certain Textbox have that expression but at the same time it could be possible that "Dataset" does not have the values that "Dataset1" have. I can't Nest Lookups because I was trying to do the following:
=IIF(IsNothing(Lookup(Trim(Fields!total_Cod_vendedor.Value) & "-" & ReportItems!G1.Value, Fields!AgregarMost.Value, Fields!most_atados.Value, "EfectividadDeFrecuencias_Most")
AND IsNothing(Lookup(Lookup(Trim(Fields!total_Cod_vendedor.Value) & "-" & ReportItems!G1.Value, Fields!AgregarMost.Value, Fields!most_Cod_vendedor.Value, "EfectividadDeFrecuencias_Most") & "-" & ReportItems!G1.Value, Fields!Agregar.Value, Fields!total_atados.Value, "EfectividadDeFrecuencias_Total")
)) = True
, "0"
,Lookup(Trim(Fields!total_Cod_vendedor.Value) & "-" & ReportItems!G1.Value, Fields!AgregarMost.Value, Fields!most_atados.Value, "EfectividadDeFrecuencias_Most"))
So to give a more visual example, this was the original Case:
See how Dataset2 does not have the same values as Dataset1 so with this Expression it put 0s where is not Equal that combination (Sales Rep+Category).
Now the idea is to the same thing the other way around, when Dataset2 have data that Dataset1 does not have IN THE SAME expression (that means the same textbox where it resides the Tablix which at the same time have the Scope on Dataset).
How would you do this?

Displaying a record in a report when selecting the record ID in a combo box

I have almost finished a project and I would like some user options in the form.
I would like to allow the user to select a product code and when selected, it will find the relative record in the table and then display all the information from that in a report.
Any ideas on the best approach to this would help me out massively.
Use the combo box selection with DoCmd.OpenReport as the WhereCondition option.
So if the report's record source table or query includes a numeric field named product_code and your combo box is named cboProductCode ...
DoCmd.OpenReport "YourReport", _
WhereCondition:="[product_code] = " & Me.cboProductCode
If the field is text rather than numeric, add quotes around the value in the WhereCondition.
WhereCondition:="[product_code] = '" & Me.cboProductCode & "'"

Access Visual Basic Code for concatenating multiple fields (text and numbers together)

I have been set with the task of creating a Microsoft Access database to store customer feedback and to generate a printable report when negative feedback is logged.
On my Feedback form where users can log feedback details, I am trying to develop code to concatenate fields taken from the Feedback table (which the form's record source is set to). What I am aiming to do is develop a unique number which is made up of the following fields from the Feedback table:
Company name (this is actually a lookup field in the Feedback table which looks up Company Name in the Company table so is therefore a combo-box on the form - appears as a drop down menu on the form)
Product name
2 digits of the week number
2 digits of the month
2 digits of the year
(These three date items are extracted from a field called Feedback date in the Feedback table).
A sequential number starting from 1 which increments so that if another piece of feedback is logged on the same product by the same company this number then changes to 2 and so on.
Basically, the example I'm wanting to replicate is to look like this:
Company Name_Product Name_0712131
The output of these concatenated fields is meant to be stored in another field in the Feedback table called CF#.
What kind of code should I be writing so that the information I want concatenated gets saved to the database?
There are many different ways to add a record (CurrentDB.Execute({SQL code}), ADO commands, DAO commands, DoCmd.OpenQuery), but I suspect you want to know how to create the expression that you are going to add:
Dim strCustomerRef As String
'Add the Company Name (assumes the name is in the second column)
strCustomerRef = Me.cboYourComboBox.Column(1)
'Add the Product Name (assumes you have a text box bound to the product)
strCustomerRef = strCustomerRef & "_" & Me.txtTheProductNameTextBox
'Add the date info (assumes you have a text box bound to the date)
strCustomerRef = strCustomerRef & "_" & Format(Me.txtFeedbackDate, "wwmmyy")
'Add the sequence number
strCustomerRef = strCustomerRef & "_" & DCount("CustomerRef", "CF#", "[CustomerRef] Like '" & strCustomerRef & "*'") + 1
'Code to append record here
CurrentDB.Execute "INSERT INTO [CF#] ([CustomerRef], [MoreData]) VALUES ('" & strCustomerRef & "', '" & Me.txtMoreData & "')

how to overwrite a parameter default value in SSRS?

I'm using SSRS 2008 and I have two reports (A and B). B has 4 parameters for which I have assigned a default value. Both reports work fine on its own
The problem is that I want to be able to call report B from report A and use the selected value to overwrite one of those parameters in report B.
So far what happens is that Report B appears when it's called from Report A but the parameter that should be overwritten remains blank and causes the data not to load at all, the. The other parameters show the default values but the 4th one remains blank.
I have tried:
taking off the default value and didn't work.
order: I also read a post here about the order of the parameters and I chose to leave the one that needs to be overwritten last in report B.
data types match among the parameter being overwritten and the value being sent from the parent report (string).
the omit parameter expression is set to false which enables the value to pass through to the drill-down report.
Any thoughts?
I've done this recently by setting a click action in a tablix control. Essentially, I went to the Text Box Properties I went to Action and then set the action as Go to URL. I've then put an expression in for the following (which you can modify to your needs depending on the destination report name and parameters):
=IIf(
Parameters!p_hide_links.Value="y",
Nothing,
"javascript: void( window.open('http://' + window.location.host + '/ReportServer/Pages/ReportViewer.aspx?/Property+Management/" & replace(Parameters!i_this_report.Value, " ", "+") &
"&p_from_date=" & Parameters!p_from_date.Value &
"&p_to_date=" & Parameters!p_to_date.Value &
"&p_lease_exec=" & Fields!submitted_by.Value &
"&p_building_state=" & Parameters!p_building_state.Value &
"&p_division_id=" & Parameters!p_division_id.Value &
"&p_building_id=" & Parameters!p_building_id.Value &
"&p_view_type=d" &
"') );"
)