Currently I'm using Birt Report to generate report from my system. I'm using input parameter to send parameter from my system to Birt Report. The problem is when I'm trying to send multiple parameter from my system.
SQL statement at Birt Report for one parameter
select actualdate from table1 where storeloc = ?;
When I use this query for one parameter, it work.
I tried sql like this
select actualdate from table1 where storeloc = params["storeloc"].value;
I already created parameter at data set and report parameter but it's still can't gets to work
and also birt dont show me the options in edit dataset for query and Linked To Report Parameters in parameters
so what should i do?
Create a parameter storeloc in report params section of Data source.
Write this query in dataset open:
select actualdate from table1 where storeloc='"+params["storeloc"]+"';
Fetch the actualdate value in data source fetch and run the report.
Related
I have a dblink called times.
Im creating oracle report.
This is my query:
select
tbloola_master."account_name" acctname
from
"tblOOHA_Master"#times tbloola_master;
Problem:
When I run the report, I GOT EMPTY REPORT.
I tried converting the field using TO_CHAR and it works.
select
TO_CHAR(tbloola_master."account_name") acctname
from
"tblOOHA_Master"#times tbloola_master;
I don't understand.Please help.Thanks.
I use Crystal report 2011 to create report from with data from Oracle database. I have a Allow multi values parameter name userid (userid is string).
I want to query
Select ... from table where userid in {?userid};
I try {?userid}, ({?userid}), '{?userid}' ... but it's not working.
what should I do?
Put the cursor on the place where you want it, and double click on the parameter.
I have a new Crystal Report, starting from our company's standard template, which has two connections: one to get some header information and then the Oracle stored procedure. When I run the report, only data for the header shows. That means the connection is working.
When I do a Show SQL Query, I can see the second query is not sending any parameters to Oracle:
OraDB
SELECT *
FROM HeaderInfo RPT
WHERE RPT_NUM = 'RPT829'
OraDB
BEGIN "OraUser"."Proc_829"(:CRYSTAL_CURSOR, NULL, NULL, NULL); END ;
I've entered the parameters, but there is a linkage missing somewhere, because it's just NULLs here. Where do I set that?
I have tried re-creating the report, starting from the same template, and it does not work. I have started a new report, adding my parameter first and then the command for the header, and it does. It just works, and binding those variables isn't something that is normally done manually. But when the binding doesn't work, is there a way to force it?
In my field explorer, it has the following:
- Database Fields
.....+ Proc_829
.....+ Command
+ Formula Fields
- Parameter Fields
.....Divisions
.....StartDate
.....EndDate
When I refresh, it asks for those parameters, which match the parameters that the Proc_829 needs. But it shows no data (the proc runs in Oracle and returns data with those same parameters), and the Show SQL Query, as above, is sending nulls.
The standard is to avoid the use of a subreport, and start with this template. The template was changed recently, but I've used previous iterations and it has worked. The template has the Command and some header information already added, and common parameter fields, which happen to match what my procedure needs.
Edit Here is the opening (obfuscated) part of the procedure:
CREATE OR REPLACE PROCEDURE PROC_829 (
CRYSTAL_CURSOR IN OUT SYS_REFCURSOR
,Divisions IN VARCHAR2
,StartDate IN DATE
,EndDate IN DATE
) IS
-- bunch of stuff here, including
OPEN crystal_cursor FOR
-- my select stuff that returns data in Oracle
I have several reports, and on each one of them i have a few tables included.
Lets say 3 tables, tableA, tableB and tableC.
I want to use the following Oracle Function to filter the result set passing also a report parameter:
AND function(tableB.field1, tableB.field2, tableB.field3, {?report_parameter}) = 'S'
Facts to be aware of:
Oracle Functions can only be used on SQL Expressions and/or SQL Commands in Crystal Reports.
SQL Expressions cannot contain report parameters (so, not an option).
Crystal Reports lets you replace a report table with a SQL Command, but does not let you replace several tables to a single SQL Command.
We do not want to re-build all the reports all over again.
We do not want to replace a single table to a SQL Command because it affects performance in a high level since Crystal does not transform the tables and the SQL Command on a single query when executing the report.
This Oracle Function selects data from other tables and therefore can not be rewritten on a Report Custom Function.
The {?report_parameter} is an information that only the application knows. It is filled by the application before exporting the report to the user.
What could I do to work around this?
No knowing exactly why your function requires tables and parameter, I can only give you vague, untested options. None of the options are ideal:
rewrite your Oracle function as 'Custom Function' (CF); reference CF in record-selection formula; filter will be applied WhileReadingRecords (i.e. the function will not be sent to the database)
rewrite your function as a stored procedure that accepts one parameter, but returns a record set (the parameter will be recognized by Crystal Reports); join the other tables to the stored procedure. The stored procedure will need to be written in a manner that will support Crystal Reports' data needs (using result from a stored procedure with parameters as value for gauge chart - crystal reports in asp.net application)
I am using the BIRT report writer, and I have multiple tables with the same data structure. In my report design, I want to select the table my query uses as a report parameter (as part of a mysql query in the data set) -- but I can't figure it out.
When I create the data set, it's great that I can use parameters in the form of SELECT * FROM WHERE ?, and set these to report parameters, but I get an error if I set the ? to the table, such as:
SELECT * FROM ? WHERE 1
Is there another way I can do this? As it's java, I assume the syntax follows that of a PreparedStatement. In BIRT 2.5 there is a property binding option under the data set dialog... and I've tried setting my query as: "SELECT * FROM "+params["DataTable"].value+" WHERE 1", but that was also results in an error.
I just answered this same question over at BIRT Exchange: http://www.birt-exchange.org/forum/designing-birt-reports/19097-set-query-table-using-report-parameter.html#post62590
I should note that the queries MUST return the same fields & data types after you modify them. I only note this because of your statement above that the table structure varies "a bit". It is perfectly safe to modify the FROM or WHERE clauses in a BIRT query, but you cannot modify the actual SELECT construct.