Dropdown with Checkbox in SSRS - visual-studio

I have a report in SSRS which is generated for around 50-60 items.
Say, the report shows Country name on one scale and their population on another.
When the graph is generated, it shows around 100 countries.
If I want to see population of only UK, US, India and China. Then I Should have an option to select the countries of my choice.
Having one dropdown and allowing them to select only one country at a time is simple.
I have no idea on how I can have a checkbox in dropdown to allow multiple selections.
TIA.

You'll want to search for Multi-valued Parameters. If you open the properties of the parameter there will be an option something like "Allow multiple values". Reporting services will handle the UI with checkboxes.
One important thing to know about multi-valued parameters is how to use them in your query. Suppose your parameter #CountryId is being filled with this query:
SELECT CountryId, -- This will be the value for the parameter
CountryName, -- The label for the parameter
FROM Country
If you set this parameter to allow multiple-values, reporting services will generate the multi-select UI for you. When executing any subsequent query that uses the parameter, before sending the query to your SQL server it will replace the parameter with a comma-seperated list of CountryId values. So this query:
SELECT *
FROM MyDataTable
WHERE MyDataTable.CountryId IN (#CountryID)
Will be sent to SQL server as something like this, supposing there are 3 countries selected:
SELECT *
FROM MyDataTable
WHERE MyDataTable.CountryId IN (1001,1002,1003)

Related

Number filed is not processed correctly

I use Oracle Apex, I want that my 'display only field' is updated automatically. Well, when I use dynamic actions like this select 5 * price from ... or, for instance, random values, it works absolutely correctly, the field is filled with the value 5 * price (or set new random value). But when I use select :P4_COUNT * price from, the filed is empty. I think that the problem in :P4_COUNT (it is a number field) but I do not know what to do.
In the Dynamic Action, look for "Items to Submit" (usually under the SQL or PL/SQL code). Put the names of items that need to be submitted to session state prior to running the code. Also, note that currently, all values in session state are strings. So it's probably best to use to_number if you need a number.

How to use bind variable in oracle report parameter form?

I have a parameter form with a value for the fiscal year and equipment ID. I want to populate the equipment ID list of values based on the fiscal year that is selected.
My query for the equipment ID list of values would be
SELECT EQPID,NAME FROM EQPLIST WHERE FY = :FY.
When I tried to add this query to the list of values of the equipment ID parameter I get
REP-0781: Bind variables are not allowed in the Select statement.
Is there a way to dynamically generate the list of values select statement in a reports trigger?
Cascading LoV, eh?
Which Reports version do you use? If it is 6i (client-server), I believe that your only resort is to create a parameter form using Oracle Forms, and then pass those parameters to a report.
If you're on a higher version (web-based), have a look at Metalink note 185951.1 ("How to create a parameter LOV based on another parameter value?") which includes sample code. Or, as above, create your own parameter form in Forms (that option works in any version).

Can I use a list to repeat two tablixes on a report page?

See image below. Warehouse and Customer are dropdown lists populated via query. Year is a text field. The two tables display data from datasets driven by the report parameters. Is there a way to repeat the two tables based on each member of the Customer dropdown? Preferbly with a pagebreak after the 2nd table.
I normally do this using subreports. You could either create a single subreport that contains both tables or individual subreports. The individual approach might help with page breaks etc so that's the way I'd go.
Step 1: Create a report for your first table.
As you don't state what each table does, I'll make some up for the sake of illustration.
The key is to create a subreport that displays just the info you need in a single table. So in your case this might mean we only need to pass in a single parameter, CustomerID. You might need to pass in more such as Warehouse but I don't know...
In my made up scenario, let's assume the report shows customer contacts so we create a subreport (let's call it subCustomerConacts). It has a single parameter pCustomerID and a single dataset dsCustomerContacts. The query might looks something like SELECT * FROM CustomerContacts WHERE CustomerID = #pCustomerID. Add whatever tables/textbox etc you need to display your data.
Test this subreport works by manually typing in a CustomerID
Step 2: Create a report for your second table.
Do exactly the same again, creating a new subreport. Let call this subCustomerOrders. Repeat as above until you end up with another report that can display order details (or whatever you need).
Finally, create you main report.
This is basically what you have described in you question in terms of parameters etc.
Now to add this bit that will call you subreports.
Create a dataset (let's call it dsCustomerLoop) that contains each customer from your parameter something like SELECT DISTINCT CustomerID FROM myCustomers WHERE CustomerID IN (#myCustomerParameter)
Add a table to your report, 1 column wide and stretch it so it's wide enough to accommodate you subreports.
Set the dataset to point to dsCustomerLoop
Right-Click the cell in the detail row and do "Insert Row -> Inside Group - Below". You should not have two detail rows.
Next, right click the top detail row and do "Insert -> Subreport"
Right-Click the newly inserted subreport control and choose "properties".
Choose your first SubReport form the drop-down list
Click parameters on the left,
Click "Add" and select the CusomterID parmeter, set it's value to the CustomerID field.
Repeat this process on the seconds row, choosing your seconds subreport.
You may want to also add a 3rd row to the table, you could insert a rectangle into this with page breaks set to force a new page after each seconds subreport.
That's It. When the report runs it will produce two rows per customer, each row containing a subreport.
I hope this is clear enough, I've rushed through it a bit but if anything is unclear, let me know and I'll provide a clearer solution.

SSRS Tablix Dyanmic Column Groups on Parameter values with Page Breaks

I currently have a tablix that looks like this:
I also have three parameters:
When the user selects the report parameter, this tell the query what columns in expected value to show. So the columns pivoted are dynamic based on that parameter.
If the user selects multiple parameters for report, I'd like the report to page break based for each parameter they choose.
Example:
Here the user chose ILO, IP, and LogicDrive for the report parameters. These are all the columns that will show in expected value.
Instead off all them being grouped together, I'd like the to create individual column groups with a page break in between.
Is this possible?
Update
I managed to get the column values grouped by the parameter:
I created a parent column group like this:
Now my issue is getting the page breaks in between each column grouping.
I read based on this Microsoft doc that it may not be possible:
https://learn.microsoft.com/en-us/sql/reporting-services/report-design/add-a-page-break-report-builder-and-ssrs
It says: Page breaks are ignored on column groups.
Is this still true?

SSRS reports dynamics crm have current record id used as parameter

Hi for my ssrs report In dynamics crm I require that when the report is ran against a certain record, the records passes the record id so that only the relevant results are displayed.
How is this possible ? Steps provided will be great also
Reports are created using SQL.
Run against campaign entity
SSRS reports for CRM have special parameters that enable this for you. To filter by selected records (or the current record you have open) you can utilise a hidden parameter called "CRM_Filtered[Entity]" where entity is the relevant entity you are linking the report to.
In your case, i.e. for the campaign entity, this hidden parameter will be called CRM_FilteredCampaign. For a SQL report this will be a text parameter and will be set to something like this (set by CRM when you run the report)
select campaign0.* from FilteredCampaign as "campaign0"
I do not have a report to hand to check exactly what the SQL will contain, so it might not be exact. But you get the idea. There are several ways to embed this in your report, but you could do so in a rudimentary fashion like this in a dataset:
declare #sql as nVarchar(max)
set #sql = 'SELECT c.campaignid FROM (' + #CRM_FilteredCampaign + ') as c'
exec(#sql)
Expanding on this, i.e. rather than executing text SQL in your main dataset, you can instead simplify the usage by creating a dataset/parameter combo based off the text. In effect, convert the SQL text to a list of values instead.
So add the above SQL to its own DataSet (for this example called DS_FilteredCampaign).
Once you have created DS_FilteredCampaign make sure you click on the Refresh Fields button. Type in the following instead of <null> for the parameter value:
select c.* from FilteredCampaign as c
Once that comes back click on Ok to save the DataSet.
Next, create another hidden text parameter (e.g. Int_FilteredCampaign) and tell it to get its default value from a DataSet (not its available values, its default value). Point the values at DS_FilteredCampaign, and you should be able to select campaignid as its value field. This in effect makes the parameter an array of Ids you can reference in your main DataSet
Now it's much more usable as you can reference it in your SQL something like this in your main DataSet:
select c.*
from FilteredCampaign c
inner join ActivityPointer ap on ...
inner join FilteredAccount a on ...
where c.campaignid in (#Int_FilteredCampaign)
The important piece being where c.campaignid in (#Int_FilteredCampaign)
Summary Steps:
You have a main DataSet called something like dsMain
Create a new parameter called CRM_FiltetedCampaign
Create a DataSet (DS_FilteredCampaign) that executes the SQL passed into CRM_FilteredCampaign
Refresh Fields on the data set to get the campaignid field
Create a text parameter (Int_FilteredCampaign) that retrieves its default value using the new dataset (DS_FilteredCampaign) using campaignid for the value
Reference this new parameter in you dsMain dataset

Resources