How to maintain the current slice selected by the user in webdatarocks report? - razor

I am using the WebDataRocks reporting tool in asp.net core razor view, the user specifies some form inputs to filter the report with, and clicks show report to display the report, and when the user selects additional fields to be displayed ( from the report "fields" option in the report toolbox), and click show report again ( may he changed the filtration inputs), the newly selected fields disappear and display the fields based on the specified slice at the beginning, Is there a way to save the last selected fields (slice) by the user with the subsequent requests to display the report?

The Fields List does not save its state after some field or measure is added or removed. To change the slice, press the "Apply" button inside the Fields List.
Also, you can use the following API calls to implement a custom Fields List where all the changes are applied immediately:
getRows, getColumns, getMeasures, getReportFilters - get the
current slice configuration
getAllHierarchies, getAllMeasures - retrieve all the data about
fields
runQuery(slice) - modify the slice in runtime. Contains
rows, columns, measures, and reportFilters options from the slice
object

Related

Report Builder 3.0 - permit user to add data in after report generated

Using Report Builder 3.0 against cubes which are produced overnight.
The report I'm designing is used to archive or transfer (physical) files for patients. Users run the report, print it & then attach it to files that are then sent to a central area which will archive/send the files on.
The report has a number of parameters which is designed to return a single patient. This all works fine.
One of the parameters (#prmReason) is a single choice on what is to happen to the files, eg, "Transfer" (transfer files to another office), "Archive - closed", "Archive - deceased", "Archive - excess" (office space is limited, so staff archive off 'older' files).
One of the fields returned is CloseReason. This field always has a value. If the field is empty in the database (as the client hasn't closed), then it will contain the value: "Unknown".
This field (amongst others) are either displayed or hidden, depending on #prmReason. Again - all working without a problem.
Now for the tricky bit.
If the #prmReason = "Archive - closed" or "Archive - deceased" then the report will display CloseReason.
The problem is if CloseReason = "Unknown" then I need to know the why the file is closed & display it on the report.
I want users to be able to choose a value from a list of closure reasons. I then want the choice to be displayed on the report. Obviously if there is a genuine reason then display this value.
So the effect I'm after is:
User selects parameters & runs report.
Report then checks to see why report is being run (eg #prmReason).
If #prmReason =("Archive - closed" OR "Archive - deceased") AND CloseReason = "Unknown"
Then somehow produce a list of CloseReasons that the user can select. This value is then displayed on the report.
I can even cope with it being a free text field. Just something so that the central area can update the database if necessary & save a phone call/email etc.
(Yes, I realise that I can have the list as a series of tickboxes that the user ticks after the report is printed, but this would be a useful ability in other reports).
EDIT: empty value of CloseReasons conflicted with stackoverflow formatting (sorry didn't review post properly). Value is actually less then symbol then the word Unknown and then greater than symbol. It doesn't really affect the problem
You could add an additional hidden parameter.
If this parameter is not set then display an small table on your report that has a list of CloseReasons.
You then set table cell's action property to open the a report, choose your existing report as the report to open but this time you can pass a value for the final parameter, which, as well as displaying the Close reason in your report, would also hide the close reason choices table described above.
UPDATE To make clear more clear.
The following is based on the Northwind sample database. I have a shared data source pointing to this database.
Create new report.
Add a data source pointing to the shared Northwind data source
Add a new data set pointing to the data source above with the following query
SELECT
EmployeeID,
FirstName, LastName, Address, City, Country, Title, Notes
FROM Employees
WHERE EmployeeID = #EmployeeID
Add some of the fields to the report to show some basic info.
We now have a simple report with a single parameter #EmployeeID
Next we want to show some actions for each employee. For flexibility, I'm making this list dynamic based on the employee's Country. This list could be static.
Create a new dataset dsActions with the following query
DECLARE #actions TABLE(ActionID int, ActionLabel varchar(20))
-- Get employees country
DECLARE #Country varchar(20) = (SELECT Country FROM Employees WHERE EmployeeID = #EmployeeID)
IF #Country = 'UK'
BEGIN
INSERT INTO #actions VALUES
(1,'Sack them'),
(2,'Buy them a pint'),
(3,'Promote')
END
ELSE
BEGIN
INSERT INTO #actions VALUES
(1,'Fire them'),
(2,'High 5 them'),
(3,'Ask them to run for office')
END
SELECT * FROM #actions
Add a table to the report to show these values.
At the moment my design looks like this. (All the expressions are simple fields from the first dataset to show the employee details, nothing special)
And when I run it I get this.
OK, now all the basics are done, we need to be able to call this report again, but with an action already chosen. We'll make the actions table clickable and pass the action's label to the report.
It's the same report, we will only ever have a single report.
First, add a new parameter called action to the report and make it hidden. Add a default value of 'noaction'.
Next we want to only show our actions table if the action parameter is set to 'noaction'. To do this, set the Hidden property of the action table (tablix) to the following
=Parameters!action.Value <> "noaction"
Next we want to add a text box that displays the result action parameter, but only when the action parameter is not noaction.
So add a text, set it's expression to =Parameters!action.Value and the hidden property to =Parameters!action.Value = "noaction"
Finally, we need to make our actions list call our report but with a specific action. To do this we need to modify the actions table.
First save the report, whatever name you choose is the name you will select as the target report as the report will call itself.
Right-click the cell that contains the ActionLabel and go to the text box properties.
Select the Action tab and then choose "Go to report". Choose the name of the report you are currently working on (this actual report as the report will call itself).
Set EmployeeID parameter to [#EmployeeID] and the action parameter to [ActionLabel]
I've used the label for simplicity but you could pass the ActionID as long as you account for this in the text box that displays the action.
Optionally you could format the text so it looks like a link,
The final design and action/parameter setup looks like this
When I first run the report I get the following...
As soon as I click one of the actions, I then get this...
Hopefully that's clear now.

How to exclude hidden data when exporting report to CSV on SSRS?

I have this report that has a parameter that users can select which view will appear when they run the report.
It has 3 options, Cluster view, Country view and Raw data view. Cluster view has a matrix and chart in one rectangle, Country view shows a matrix then Raw data view is a simple table.
I just hide the object when they are not included on the view. I put an expression on Hidden property.
So now, my problem is when I extract the report in csv. with Raw data view selected, the file includes the datasets for the two other views. How can I remove those so users can only see the data for raw data view?
One option would be to have each view set up as a separate report. Instead of parameters, the first report would have links to the other reports. You can do this with a textbox action. When they choose to export it will only be able to export the dataset from the report they have chosen.
The CSV Renderer doesn't respect the hidden property. I would say use [&RenderFormat.Name] as a dataset filter to exclude the data itself, but unfortunately you can't use that variable as a parameter or tablix filter.
You could create a CSV-export version of the report. Then you could create a link on the main report which specifies the export mode with a link, using the format: http://myrshost/ReportServer?/myreport&rs:Format=CSV.

Interactive Cascading Prompt in SSRS

I have 2 parameters Country as TextBox and State as DropDown. Country parameter asks user to enter value manually and based on that Country entered the State Parameter gets populated.
But, After entering the text in Country it is required to press enter or view report button by which I am getting an error first (Please select a value for parameter State) and then the State parameter is getting populated.
Is there any way to do this without pressing enter or clicking on view report? OR Pressing enter without error prompt(Please select a value for parameter State).
You're trying to do more with SSRS parameters than they were intended for.
The cleanest solution would be to build a "searching" report that would use the MovieNamePart parameter and display a list of all of the matching movie titles.
You would then put an action on the text which would open the other report and pass the full name of the movie.
Alternatively you could just bring in all the info about the movie as well and have it displayed as a collapsed section under each name. The user would then have access to all of the information about all of the matching movies without needing to load another report.

Autocomplete Fields in Split Database

I created a data entry from and split my database to front-end and back-end. When I enter in data I want certain fields to autocomplete. To be specific, I want to do something like (assuming the term Request had been previously entered) when you type in Requ... it would show Request and you could just press enter or tab to move to the next field. I don't want the rest of the fields autofilled, just individual fields autocompleted. Not sure if the fact that the database is split prohibits this?
Using a form, set the controls for the fields you want to autocomplete to comboboxes and the row source of the combo to a select from the table:
Control Source : MyFieldToComplete
Row Source : SELECT DISTINCT MyFieldToComplete FROM MyTableWithMyField
Limit To List : No
There are wizards for building combos, or you can change controls manually with right-click.

How to reference in SSRS report (in client mode) objects from application

I have a report created in SSRS in client mode, which is run disconnected: I create the data source in code and pass to the report as a DataView. It works ok.
But I need to be able to reference from the project to some objects (variables, whatever) from my application, as follows:
I need some totals that are not calculated based on data in report. e.g. the reports show total sales in a period, with own total, but I need to display a field in report footer - previous month total (actually they are about 10 other "previous" totals).
I need to have some columns show / hide based on some settings in the application (e.g. I have application option : Show Previous month sales)
Any thoughts on how to do this?
Thank you
Q1-> In order to use data in your reports, you need to specify the data inside of a Datasource object. You cannot simply use the variables if that is what your intentions were. So yes, you are doing this the right way. *** Sorry, you could theoretically used Report Parameters for this.
Q2-> This is the real reason to use Report Parameters. You can pass parameters to the report to do exactly this. If the HideColumn parameter (for example) is set to true, you could hide all the columns that need to be hidden.
http://msdn.microsoft.com/en-us/library/ms251750%28VS.80%29.aspx
For question 1 - the data - the easiest approach would be to create a DataTable in memory and add it as another dataset OR to add fields for your original dataview that contain these values.
Question 2 - To hide or show the columns based on settings make the column visibility an expression based on the value of a parameter, in your code behind set the parameter value to your application setting.