I have 2 SSRS reports that have been deployed to the report server.
Report 1 has action that allows the user to open a new window for Report 2.
Below is the example of my Report 1.
Department
Success Count
Failure Count
Running Count
Department 1
10
2
25
Department 2
18
5
12
Report 2 is a drilldown report that shows all the details within that department.
The idea is when I click Department 1, it will show all Success/Failure/Running data within department 1
And when I click the number under the specific catalog, it will only shows the corresponding data.
For eg: If I click 10 on the first row under Success, it will only shows the department 1 with success data.
What happening right now is when I click 10, it did show the success data within department 1,
However, If I click department 1 again, it still shows the department 1 with success.
(if I click department2, it would shows department 2 with success)
So my assumption is the parameter is not reset when I click the first column.
How do I reset my parameter on my SSRS?
I hope my explanation is clear enough to understand, if you need more visual explanation, I can paste here.
Edit:
Attachment 1 Dataset for Drilldown Report 2
SELECT * FROM [DASHBOARD].[dbo].[ENTERPRISE_LOGGING_SUMMARY]
WHERE [DEPARTMENT] = #DEPARTMENT AND
TYPE1 = #TYPE AND
STATE =#State
Attachment 2 Action for Department column
="javascript:void window.open('" & Globals!ReportServerUrl
& "/reportserver?" & Globals!ReportFolder & "/DrillDownReport&TYPE="&Fields!TYPE1.Value
& "&DEPARTMENT=" &Fields!DEPARTMENT.Value & "','_blank','width=1500,height=750,scrollbars=yes,resizable=yes,toolbar=no,status=no,menu=no,top=20,left=15')"
Attachment 3 Action for STATE(Success/Failure/Running)
="javascript:void window.open('" & Globals!ReportServerUrl
& "/reportserver?" & Globals!ReportFolder & "/DrillDownReport&rs:Command=Render&TYPE="&Fields!TYPE1.Value &
"&DEPARTMENT=" &Fields!DEPARTMENT.Value &
"&State=" & Fields!STATE.Value &"&rs:Command=Render','_blank','width=1500,height=750,scrollbars=yes,resizable=yes,toolbar=no,status=no,menu=no,top=20,left=15')"
I'm guessing you drill down report only takes single values for parameters.
It looks like the department action is not sending the state parameter. So you could try setting it with something like
="javascript:void window.open('" & Globals!ReportServerUrl
& "/reportserver?" & Globals!ReportFolder & "/DrillDownReport&TYPE="&Fields!TYPE1.Value
& "&DEPARTMENT=" &Fields!DEPARTMENT.Value &
& "&State=all" & "','_blank','width=1500,height=750,scrollbars=yes,resizable=yes,toolbar=no,status=no,menu=no,top=20,left=15')"
Then update the dataset query to something like this
SELECT * FROM [DASHBOARD].[dbo].[ENTERPRISE_LOGGING_SUMMARY]
WHERE [DEPARTMENT] = #DEPARTMENT
AND TYPE1 = #TYPE
AND (STATE =#State OR #State = 'all')
Related
I am trying to create a report with Report Builder where I have a list of data coming from a dataset (SQL View). The column Test, does not contain data from this dataset, but is an expression to get the values from another dataset.
The expression is: =Sum(Fields!COUNT.Value, "TestDataset")
I want to fill the Test column with the count using the Unique ID (1st column) for that row, meaning that each row would have different count numbers in the Test column. Basically, I want the SQL where clause to be the Unique ID for each row.
This is the list showing if no parameters are filled:
Empty parameters:
Then I can use the Unique ID parameter to search for a specific ID:
Result of the specific unique ID search - but as you can see test is not updating as it is refering to the "Identity UID" parameter that is left empty:
Filling out the "Identity UID" field, will then trigger that expression above and fill out the number.
Same result for all rows, as it is not adjusting to the data in the row but only in the parameter. So it is just repeating.
The reason it is 2 different datasets is that data is from 2 different tables and I am not aware of how I can join the TestDataset (Count(*)) with the other SQL View dataset.
I also looked at LookupSet but I do not have a field to join on when using Count(*).
I am using T-SQL (SSMS / SSRS).
Expression SQL from first dataset:
"SELECT TOP " & Parameters!MaxRows.Value & " ObjectID,UID,Name,BLABLA... "
& ",(SELECT Count(*)" -- SUBQUERY
& " FROM INT_RA "
& " Where IdentityUID like '%' + #UID + '%'"
& " AND (AccountObjectID = -2 OR Account_IdentityJoinConfirmState like '%Confirmed%')"
& " AND GETUTCDATE() BETWEEN EffectiveTime AND ExpirationTime"
& " Group By IdentityUID)" -- END SUBQUERY
& " FROM AUD_IDENTITY
& " WHERE "
& IIF(Parameters!UID.Value = Nothing, "", " AND UID like '%' + #UID + '%'")
& "... lots of where clauses";
Can someone assist me with a VBA code that does the following?
Given query "Query1" and Table "Table1" in an Access DB
I would like to create a command button to loop through Query1, lookup and match a field.
Lookup [Query1].[number]=[Table1].[number]
set [Table1].[length]=[Query1].[Tlength]
For all the numbers in Query1
Not all numbers in Table1 exist in Query1
(I currently have the table1 fields in a form, if I made this operation in a query, I would not be able to add a new number entry in the form, that is why I would like to create macro command button on the form to update a length field in the table)
So when the command button is pressed table1 Tlength would be updated as such:
Query1:
Number | Length
N001 | 120
N005 | 60
N006 | 50
ect.
Table1:
Number | Tlength
N001 | 120
N002 |
N003 |
N005 | 60
N006 | 50
ect.
This can be achieved with a quite simple update query.
If Query1 is an updateable query, we can use an INNER JOIN to construct our update query:
UPDATE Table1 INNER JOIN Query1 ON Table1.[Number] = Query1.[Number]
SET Table1.TLength = Query1.[Length]
However, if Query1 is not updateable, we will need to use a DLookUp:
UPDATE Table1
SET Table1.TLength = DLookUp("Length", "Query1", "[Number] = '" & [Number] & "'")
You can easily execute the SQL on a button click using either a macro or VBA.
I ran it with the following code given that my Table1 is "Wire_Designation" with Number and Length and and Query1 is Total_Length_Query with Number and Tlength. When I run it, it works. However, if I try to save the database thereafter, the database gives me an error that I don't have exclusive access to the database, and I would have to close and reopen the database. Does anyone know the reason?
Dim MyRst As DAO.Recordset
Dim MyRst As Recordset
Set MyRst = CurrentDb.OpenRecordset("Wire_Designation")
MyRst.MoveFirst
Do Until MyRst.EOF
MyRst.Edit
MyRst![Length] = DLookup("Tlength", "Total_Length_Query", "[Number] = '" &
MyRst![Number] & "'")
MyRst.Update
MyRst.MoveNext
Loop
MyRst.Close
Set MyRst = Nothing
My concept is this: There are three columns relating to a definite hierarchy. I would like our users to be able to input into the combo boxes in whichever order they'd like and have the information pulled in the other two combo boxes be reactive to this.
Example: Country / State / (County/Region/District/City) in a tracker; The sql referenced table with source info would be Country_Name, State_Name, County_Name
If one were to put in "Vienna" into County, one would have options for Georgia, Missiouri, etc. under state, and United States and Austria as options for Country (I have no idea the larger provincial structure for Austria to add them to a state field--this is meant as an analogous example).
If one were to put in "Virginia" under state one would get United States as an option for Country, and Various counties as options for County.
The hierarchy would be relatively normal for inputting a country, as that's the natural drill down.
I do understand how to do a cascading (one-way) combo-box. The problem lies with being unable to use a nested Iif in the control source, or being unable to temporarily amend the control source through _AfterUpdate cases--please excuse the pseudocode:
Private Sub State_AfterUpdate()
If Country = "" And County = "" Then
Me.Country.ControlSource = "SELECT Country_Name FROM Natl_Structure WHERE State_Name = " & Forms![Postal]![State]
Me.County.ControlSource = "Select County_Name FROM Natl_Structure WHERE State_Name = " & Forms![Postal]![State] & ";"
Elseif Country <> "" And County = "" Then
Me.County ControlSource = "Select County_Name FROM Natl_Structure WHERE (State_Name = " & Forms![Postal]![State]) AND (Country_Name = " & Forms![Postal]![Country] & ";"
...and flip it for the opposite case. And set up the opposite of the first case for if both were setup (not that it would be necessary at that point, but just to account for all cases). Then apply the same sort of measure to the other two combo boxes.
Any and all help would be appreciated.
You have to use IIF in your control sources to check if there is already a value in the other combo boxes or not.
Me.County.ControlSource = "Select County_Name FROM Natl_Structure WHERE 1=1" &
IIf(IsNull(Forms![Postal]![State]),"", " AND State_Name = " & Forms![Postal]![State]) &
IIf(IsNull(Forms![Postal]![Country]),""," AND Country = " & Forms![Postal]![Country])
I am very new to MS Access and yet have been working (loosely) on a DB for a while. We have a DB that tracks membership. There is a table with all of the member info in there. When new and current customers are added, or pay for the current year, the info is applied to a 'PaidYear' column. For years now, I have been adding a query listing the current years' members and adding a report that displays the output of the query.
I would like to create a report where I could (using a drop-down maybe) select the active year and other options such as City, Company Name, Phone Number, etc. Is there any way to simply set this up? It has to be easy enough for my replacements to intuitively use. ie:
Member Report for [Choose Year] <-- Dropdown
[City] [Company] [Phone] [Select Option]<--- Extra Options for reporting
I have been playing with it for a while and while I can get the design set up, I can't set up the functionality. Thank you so much!!!
Yup, if you want to filter down your report, you can write a little bit of VBA to open your report with a filter (you don't need to use a parameter query for this. It may be more efficient to do this at the query execution level, but as far as i've noticed, the performance is the same to just run the full query and filter it at runtime of the report open (Access might actually just do this behind the scenes, again, I don't really know.
Anyways, lets get to it. Here's a code snippet that you can kind of use as a starting point and adapt.
Create a button that says 'Run Report', let's call it cmdRunReport
In the On Click event for that button, you will put some code. I'm just writing this up now, so I might have some syntax errors (don't have Access on this PC).
dim multiple as boolean
dim filtering as string
filtering = ""
if me.yearDropdown is not null then
filtering = filtering + "[myYearField] = " & me.yearDropdown
multiple = true
end if
if me.cityDroPDown is not null then
if multiple then
filtering = filtering + "AND [myCityField] = '" & me.cityDropdown & "'"
else
filtering = filtering + " [myCityField] = '" & me.cityDropdown & "'"
set multiple = true
end if
end if
if me.CompanyDropDown is not null then
if multiple then
filtering = filtering + "AND [myCompanyField] = '" & me.CompanyDropdown & "'"
else
filtering = filtering + " [myCompanyField] = '" & me.CompanyDropdown & "'"
set multiple = true
end if
end if
DoCmd.OpenReport "yourReport", acViewPreview, , filtering
This is the basis of what you can do. I may have a couple if syntax errors and concatenated the filtering string incorrectly (untested), but that's where you could start.
In english, it just looks at your form's dropdowns that you use to filter. It checks if they are not null, and then concatenates their values into the "filtering" string. This string is used as a parameter in your OpenReport method.
Hope this helps.
Ok so I have a text box on my main form and I want it to show the quantity of a product chosen from a drop down list.
Now there is a complication, there are 3 stock locations for each product, but this is simplified as I have 3 different levels stored on the same record for a product, with different column names.
So what I need to do is search for the name of the correct column to find the right stock location (again from a drop down).
My stock level column heading is stored in the variable "Branch" which is a string.
Here is my code.
Me.txtSourceDescQty.Value = DLookup(Branch, "[products/stock]", "[Product Code] = " & Me.cmbSource.Value)
This is the error I get. 'Stock Level' is the column header for one of the stock locations, which is stored under the variable "Branch" in the line of code.
cmbSource is the combo box where the product code is selected.
I think Me.cmbSource.Value needs to appear in quotes:
Me.txtSourceDescQty.Value = DLookup(Branch, "[products/stock]", "[Product Code] = '" & Me.cmbSource.Value & "'")