Send stored procedure parameter into subreport - oracle

My main report is populated by a stored procedure based on one parameter. There is a sub-report in the group footer which requires the same parameter/value as the main report's parameter. The sub-report returns data linked on the group field, so the data returned is chunked between the matching groups.
I want to avoid giving both parameters the same value, but I can't find any way to use one for both cases. If I link the reports based on the parameter, the group chunk is lost and each group footer returns the entire sub-report. How can I properly use a single parameter?
The stored procedures are Oracle 9i SQL if that makes any difference.

Related

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

How to implement dynamic datasets in a SSRS report

I have the following scenario: a single .rdl file with a stored procedure as datasource. This stored procedure accepts two parameters: #ProcedureName nvarchar(max) and #Parameters xml. The functionality of the stored procedure is to call another stored procedure (most probably on a different database) with the given XML parameters. So, in essence, each of the stored procs that gets executed will return it's own dataset.
How would I go about creating a tablix/matrix that consumes the dataset without specifying the columns as the columns need to get generated at runtime?
Unfortunately, SSRS doesn't have "AutoGenerateColumns"-style functionality and resolves a number of things at design time. So the short answer is that you cannot.
The designer checks field references when saving, and will not save with a reference to a field that isn't in a dataset's field list. If a field ceases to exist after the report definition is generated, it will show up as a static blank value on the report. Expressions will do so as well, even if the field is in an unevaluated portion. So if field B is removed, this expression would still be affected:
=IIF(1=1,Fields!A.Value,Fields!B.Value)
Which means that you can't use conditional grouping expressions as a workaround, even if you had an exhaustive list of the columns that might be returned.

How to pass parameters to data set behind a data cube in 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.)

Single Database Call With Many Parameters vs Many Database Calls With Few Parameters

I am writing a Content Management System which can store meta-data about different document-types. Each document-type has its own set of meta-data fields. For example a Letter has fields like "To", "From", "ToAddress", "FromAddress" etc whereas a MinutesOfMeeting has fields like "DateHeldOn", "TimeHeldOn", "AttendedBy" etc.
I am saving this information in database in two tables: General and Specific. General store information which is common to all types such as DocumentOwnerName, DocumentCreatedDate, DocumentSize etc. Specific table is not one table but a set of 35 different tables, one for each document-type.
I have a page which contains a grid in which I show list of document. One record corresponds to one document. Since the grid is made to show documents of all types therefore first row may show a letter, second a MinutesOfMeeting, third a Memo etc.
I have also made a search feature where user can set criteria on basis of which documents list is retrieved. To make it work, there are four search-related parameters for each of the field in each of the specific tables, and all of these parameters are passed to a central procedure. This procedure then filter out records on basis of criteria.
The problem is, dealing with 35 different document-types, each having like 10 fields, I end up with more than a thousand parameters for the procedure. This is a maintenance nightmare. I am looking for a solution.
One solution is to deal with each of the specific table individually, getting back Ids, then union them. This is fine, except that I have to make 36 different calls to the database, one each for a specific table plus one for the general table.
It all boils down to a simple architecture choice: Should I make a single database call passing many parameters or should I make many database calls passing few parameters.
Which approach is more preferable and why?
Edit: The web-server and database-server are on the same machine. Therefore, network speed shouldn't matter.
When designing an API where I need a procedure to take a large number of related parameters, or even a variable list of parameters, I use record types, e.g.:
TYPE param_type IS RECORD (
To
From
ToAddress
FromAddress
DateHeldOn
TimeHeldOn
AttendedBy
);
PROCEDURE do_search (in_params IN param_type);
The structure of the record is up to you, of course. If the procedure is coded to ignore the record elements that are NULL, then all the caller needs to do is set those elements that are required, e.g.:
DECLARE
p param_type;
BEGIN
p.DateHeldOn := DATE '2012-01-01';
do_search(p);
END;

Can BIRT use the output of one query as the input for another query

I have a report that needs to be generated from two different queries.
The first query retrieves a list of information from one data source
The second query must then be called once for each of the records returned by the first query?
Each result set from the second query will then be displayed in separate report tables.
Any pointers are welcome.
It is not possible to perform a SQL join on the first and second query.
Yes this is possible lets assume you have bind your first query results to data table. you can create another table inside the parent table cell and assign your 2 data set to that table with filter of dataset 1
http://publib.boulder.ibm.com/infocenter/rmc/v7r5m0/index.jsp?topic=/org.eclipse.birt.doc/birt/birt-13-1.html
http://publib.boulder.ibm.com/infocenter/rmc/v7r5m0/index.jsp?topic=/org.eclipse.birt.doc/birt/birt-13-2.html
The functionality I require is provided by SubReports
http://www.eclipse.org/birt/phoenix/examples/reports/birt2.1/subreport/index.php

Resources