How to pass parameters to data set behind a data cube in BIRT? - birt

I have a data cube which is based on a data set. The data set takes a number of parameters. So far I have not been able to find out how to pass parameters to that data set. I see that it is possible to set a filter on the data cube but that doesn't help me.
How can I pass the necessary parameters to the data set?

To pass parameters to a relational data source in BIRT:
Set up appropriate Report Parameters (via the Data Explorer).
Add parameter markers (ie. ?s) to your SQL query where you want to parameterise the query (eg. if you want to select customers by country, change your datasource query to be SELECT * FROM CUSTOMER WHERE COUNTRY = ? ).
Add dataset parameters to your dataset (via the Parameters tab of the Edit Data Set dialog) in the order they appear in your SQL query, and specify the corresponding Report Parameter in the Linked to Report Parameter value of the New Parameter dialog. (This is how you manually bind the Report Parameters to the parameters in the query - you will need to set up a dataset parameter for each parameter marker in the SQL query.)
If you now preview the report, it should prompt you for parameter values and then display the report (appropriately filtered).
If you were using a non-relational data source, you would set up a filter at the dataset level instead of parameterising the query - there is an example of this approach here. (You can do this with SQL-based reports too, but it is less efficient than filtering at the query level.)

Related

Trying to generate SSRS report based on input parameters in visual studio

I have an AX query dataset that I'm trying to use to generate an SSRS report. I want to the user to be able to enter 2 parameters (Date and ProjectId) and have the SSRS report return a table based on the query using the parameters inputted by the user. Can't write any code so it needs to be purely graphical.
You can simply add your parameters to query as query ranges.
In the AOT, click Queries, and locate the query that you want to define a range for.
Expand the query, click Data Sources, and then expand a data source.
Right-click Ranges, and then click New Range.
Right-click the new range, click Properties, and then select a field in the Field property list.
Type an expression in the Value property to specify which records are retrieved.
here it's a helpful link for creating queries with ranges:
https://msdn.microsoft.com/en-us/library/bb314753.aspx
Here is a walkthrough to follow:
https://technet.microsoft.com/en-us/library/cc636713.aspx

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

I need to make the column values of a table case Insensitive while reading them in a Spotfire Prompt from a Oracle View

I am loading data into Spotfire report from Oracle using view. In the Spotfire Prompt when the text value is entered, whether it is Upper,lower or mixure of both the relative column values should be displayed. Since this is done at the data base level i need some way to make the column values case insensitive.
I know that column values can be converted to upper/lower case with upper()/lower() function but i need a way so that even a mixure of upper/lower cases will search the column values.
I found one more solution for session :
alter session set NLS_COMP=ANSI;
alter session set NLS_SORT=BINARY_CI;
After using the above code any SQL search for column will be case insensitive. but i need a solution where i can use it in the view of the column element.
Does the inputted value need to be a prompt? It would be possible to do this using a parameter (which could be set by a document property/ input field/ configuration block).
Within the SQL for your query, you could add a where clause something like
upper(A1."mycolumn")=upper(?myParameter)
After refreshing the parameters section of the information link ‘myParameter’ will appear. The information link can then be added as an on demand table, with myParameter being set via a document property.

Using variables in From part of a task flow source

Is there any way to use a variable in the from part (for example SELECT myColumn1 FROM ?) in a task flow - source without having to give the variable a valid default value first?
To be more exact in my situation it is so that I'm getting the tablenames out of a table and then use a control workflow to foreach over the list of tablenames and then call a workflow from within that then gets data from these tables each. In this workflow I have the before mentioned SELECT statement.
To get it to work properly I had to set the variable to a valid default value (on package level) as else I could not create the workflow itself (as the datasource couldn't be created as the select was invalid without the default value).
So my question here is: Is there any workaround possible in this case where I don't need a valid default value for the variable?
The datatables:
The different tables which are selected in the dataflow have the exact same tables in terms of columns (thus which columns, naming of columns and datatypes of columns). Only the data inside of them is different (thus its data for customer A, customer B,....).
You're in luck as this is a trivial thing to implement with SSIS.
The base problem for most people is that they come at SSIS like it's still DTS where you could do whatever you want inside a data flow. They threw out the extreme flexibility with DTS in favor of raw processing performance.
You cannot parameterize the table in a SQL statement. It's simply not allowed.
Instead, the approach that people take is to use Expressions. In your case, assuming you had two Variables of type String created, #[User::QualifiedTableName] and #[User::QuerySource]
Assume that [dbo].[spt_values] is assigned to QualifiedTableName. As you loop through the table names, you will assign the value into this variable.
The "trick" is to apply an expression to the #[User::QuerySource]. Make the expression
"SELECT T.* FROM " + #[User::QualifiedTableName] + " AS T;"
This allows you to change out your table name whenever the value of the other variable changes.
In your data flow, you will change your OLE DB Source to be driven by a query contained in a variable instead of the traditional table selection.
If you want an example of where I use QuerySource to drive a data flow, there's an example on mixing an integer and string in an ssis derived column
Create a second variable. Set its Expression to create the full
Select statement, using the value of the first variable.
In the Data Source, use "SQL command from variable" option for the
Data Access Mode property.
If you can, set a default value for the variable you created in step
That will make filling out the columns from your data source much easier.
If you can't use a default value for the variable, set the Data
Source's ValidateExternalMetadata property to False.
You may have to open the data source with the Advanced Editor and
create Output columns manually.

Filter Toolbar without loadonce:true?

I am using jqgrid, with filter toolbar(column) option...The total data is around 10,000...So it seems to be some delay in initial loading as the config is set to loadonce:true;
Any way to implement the filter column feature with loadonce:false ?
Because the data loading delay is okay with loadonce:false. If I get a chance to add column filter with loadonce:false, this will work perfectly...
If you has about 10,000 rows it is of course better to implement server side data paging, sorting and filtering. I recommend you to use filterToolbar with the parameter stringResult:true if you not already use it. In the case jqGrid will send to the server filters parameter in the same format like advanced searching as do. So you will need implement on the server side the method which use following input parameter from jqGrid:
sidx and sord parameters define the sort order of the data. The informations specify ORDER BY in the corresponding SELECT statement.
if _search parameter is true, then the next parameter filters gives additional information which construct the WHERE part of the corresponding SELECT statement.
page and rows parameters define which page of the data previously sorted and filtered should be returned.
The exact implementation is depend on the language and technology which you use on the server and of course which database server and which interface to the database you use.

Resources