SSRS Navigate to Report AND Bookmark in Single Action - reporting-services

I have implemented "Expand All" and "Collapse All" buttons in a number of different SSRS reports with the action of rerunning the report with a specific value in a hidden parameter that controls whether the groups are hidden or not. This works well enough on all single-page reports, but it always goes back to the first page on multi-page reports.
Is there a way to script both a "Go to report" and "Go to bookmark" action to a single button? I found some example code to reference a report name in an expression but not a bookmark. Alternatively, I might be able to navigate to the bookmark every time the report is run using the OnInit() event in the report's code, but I can't seem to find the syntax that would do that.
Below are some more detailed descriptions of what I'm currently doing for the expand/collapse buttons, as well as a few code snippets.
Hidden parameter named 'ParamExpandOrCollapse' of type text (I'll probably change this to a bool at some point)
Available values: "Expand", "Collapse"
Default value: "Collapse"
"Expand All" and "Collapse All" textboxes
Scripted with a "Go to report" action
Sets value of 'ParamExpandOrCollapse' accordingly
Sets value of all other parameters to what was selected when the report was last run
Row Groups' 'Visibility' property (whether they are expanded or collapsed) is controlled by 'ParamExpandOrCollapse' via expression:
=IIF(Parameters!ParamExpandOrCollapse.Value = "Collapse", True, False)
Table's textboxes' 'InitialToggleState' property (whether the toggle image shows a '+' or '-') is controlled by 'ParamExpandOrCollapse' via expression:
=IIF(Parameters!ParamExpandOrCollapse.Value = "Expand", True, False)
Please let me know if you would like any more info, and thanks in advance for any suggestions!

Related

Generating reports through a form and the navigation pane

Right now I have a report that is generated by clicking a button on a form. The criteria for the report is what the user selects in a combo box. That works fine, but when I click on the report in the navigation pane, it tells me to enter "Forms!Adjudication!Combo21" because that is the criteria it uses on the form. I was wondering if I can change that to say something like "Enter release event" that will show up when I click on the report in the navigation pane, but also leave the option to generate the report through the form?
well since your query is looking for that combo field, when the form is closed, it wont find it. however, the query is already prompting you to enter a value, so you can just enter a value in that box and it will work fine. no need to over do this. if you are looking to change the label to "Enter Release event", then consider changing the combo box's name on the form Adjudication to something that will make sense to the user, like instead of "Combo21", change it to "ReleaseEvent". That way the prompt should return "Forms!Adjudication!ReleaseEvent".
sure you can do more here to, but like i said, probably not necessary to over complicate this.

How to create pop-up window containing filter options for a report

MS Access novice here with almost no VBA/SQL experience. I've created a database with tables, queries, forms, and reports that all function well together except a few select things I'm stuck on.
Purpose of changing to the below method: Currently, I have created three main report types, with different filter options for each report. AKA: there is a SEPARATE REPORT displaying each different filter option, even though the report contains the same root information. It'd be great to have one report that allows users to filter/group/sort multiple ways to streamline the reporting process.
I'd like to have a 'Filter' button on my Reports form that opens a pop-up window containing filter options via combo boxes. To clarify - the pop-up form has been created and I can easily add a 'Filter Options' button to the report form that opens the pop-up window.
The pop-up form has combo boxes with Control Sources related to the field names on the main table that the report pulls from, as well as buttons for 'Close', 'Apply Filters', and 'Clear Filters'.
What I need help with: getting the combo boxes to supply options as well as get the 'Apply Filters' button to actually work. The filter options need to pull from fields in one of the main tables, with no text entry allowed.
'Apply Filters' button needs to do the following:
Apply filters per combo box selections. Needs to be OK for Users to leave filters blank if they choose.
Gives User a preview of the report w/ applied filters
What you really want to do is close the report and re-open it using the Filter and Preview options. Look into DoCmd.OpenReport. You will have to convert your filter to an SQL language filter based on what he user selects but everything else is pretty straightforward.
So the way I would work this is build a criteria into the form query with a parameter surrounding your popup form's combo box
then in your form vba I'd write:
Private Sub Filter1_AfterUpdate()
DoCmd.Close acReport, "Rpt2_FWItemsDue_AllSubs"
DoCmd.OpenReport "Rpt2_FWItemsDue_AllSubs", A_PREVIEW
DoCmd.Maximize
End Sub
assuming the name of the control is "Filter1" and the name of your form is "Rpt2_FWItemsDue_AllSubs" and "Filter1" filters the "FW_SubName" in the report.

How to show only "filled in" fields on an Access report

I have created a report for Microsoft access and am trying to add fields to a report only if then have been clicked on our filled out. The only way I can think of doing this is writing a code or an if-then statement in access. I have very little experience with writing code and am not sure where to begin. I'm looking for something like "If a checkbox is selected then add it to the report".
Thank you.
Instead of trying to dynamically add controls to a report you could include all of the fields on the report and then simply hide the controls that correspond to empty fields. For example, if you have a text field named [SpecialRequirements] and your report contains a bound text box named [txtSpecialRequirements] then in the On Format event handler of the report's Detail band you could use
Me.txtSpecialRequirements.Visible = (Not IsNull([SpecialRequirements]))
which is just a shorthand way of saying
If IsNull([SpecialRequirements]) Then
Me.txtSpecialRequirements.Visible = False
Else
Me.txtSpecialRequirements.Visible = True
End If
This should get you started - its a basic if structure:
If Me!myCheckBox = True Then
'Write to the report
Else
'Do something else
End If
Also check out the Microsoft Developer Network here for information on the If...Then..Else statement
This is really old, but I had the same issue above, but found a easy solution.
Go to Design view in your "report"
Make your Yes/No boxes not visible
Go to the Design tab in your tool bar
Click on the Controls and click on the Check box and place them over your Yes/No box
Delete the label it gives with the check box
Save and look at your report
Only the YES will appear as a checked box.

Changing the text in an SSRS report textbox based on the toggle state of a row group

Apparently this should have been simple. After lots of digging, I'm yet to find anything that works. I have a row group in my SSRS report whose visibility is toggled by a textbox. What I want is to have the text Show in the textbox when it's collapsed, and Hide when it's expanded.
But I can't find any property of the group that can give me its toggle state. I have found in a few forums that it's not possible. As a workaround, I've tried the InScope() function ( as suggested in http://forums.asp.net/t/1601570.aspx/1). But to no avail. Can anyone suggest anything?
I believe you are correct in stating that SSRS does not expose the ToggleState property for use in the report.
In these types of situations, I use report parameters to control the state of the report. For example, you could add a parameter named isGroupVisible to the report with a default value of 1 to represent visible. Set your group's visibility to that parameter, and set your text box value conditioned on the state of isGroupVisible. Then in the text box you set your actions to be go to a report, and set the report url to be the same report with the isGroupVisible = to the opposite of what it currently is.
You can decorate your text box all you want to give the users the indication that it can be pressed to toggle the state of the report.
Draw backs to this approach is that it isn't as snappy as the ajax calls SSRS does to expand visibility--it will post back to the server on each toggle press.
Advantages to this approach include much more flexibility in controlling the state of the report.

How Jump automatically to another report according to a value. Reporting Services

Reporting Services
I need to jump to a specific report according to the value that takes a variable data set.
For example: If the variable has the value = 2, then go to the report 'Informe_1' but if the value is = 4, then go to the report 'Informe_2', this automatically without having to click anything. That is a generic type of report which determines which of the 2 reports must be charged according to the value of the variable.
Currently I have in the properties of the variable, in action, go to report, but I need to specify the condition to be 'Informe_1' or 'Informe_2' according to the value of that variable (2 or 4).
I'm not aware of a way to automatically go to a specific report without the user clicking something; however, you can specify an expression for the Action on something and that way the user will get the report specified by your variable when they do click.
In Design view, right-click the text box, image, or chart to which you want to add a link and then click Properties.
In the item's Properties dialog box, click Action.
Select Go to report. Additional sections appear in the dialog box for this option.
In Specify a report, click Browse to locate the report that you want to jump to, or type the name of the report. Alternatively, click the expression (fx) button to create an expression for the report name.
Also, see Expression Examples (Report Builder 3.0 and SSRS) for more information about expressions.
You can also alter the visibility of a linked item similarly. To give an example, in some of my own reports I have a hidden #ReportParameter that I use to pass the report to return to when a Back link is clicked. If that parameter is empty I hide the link. I use Go to report and specify =Parameters!ParentReport.Value in the expression for the Action. For Visibilty with show or hide based on an expression selected, visible is false and hidden is true. That makes my Visibility expression =Parameters!ParentReport.Value = "".