Home
Analytics
Passing Parameter to CQ Query
Order23
Hello,
I get the feeling this should be a simple operation:
I want to pass a parameter from the BIRT report to the CQ query. Specifically I just want to restrict the CQ output to a single row of output based on the ID. I can create the CQ query, and specify a dynamic parameter, and this works. I can create a report parameter. but I can't link the two together.
Is there some simple tutorial that may tell me how to link the two together ?
Thanks for any help.
David
Find more posts tagged with
Comments
Order23
OK I am speechless. Here is the answer to my own question:
1) I created the CQ query with a filter, and specified the filter parameter as "dynamic"
-- this tests out in CQ by running the query. Parameter is prompted for and used in the query.
2) I created the report in Report Designer, adding a "Report Parameter" (Right-click on report parameters, choose "New Parameter") I filled in a name for the parameter.
3) I created a Data Source and linked it to the CQ database I wanted to use.
4) I created a Data Set and edited it to specify the CQ query is created in step 1.
5) I then configured the parameters. For every CQ dynamic query parameter, you get two parameters in the Data Set, one is the actual parameter (Postfixed by _Parameter) and one is the operator to use (Postfixed by _Operator)
The operators are given at:
https://publib.boulder.ibm.com/infocenter/cqhelp/v7r1m0/index.jsp?topic=/com.ibm.rational.clearquest.user_ec.doc/topics/t_birt_reports.htm
I chose IS_EQUAL
At this point I was tearing out what is left of my hair, since I was getting all sorts of strange errors when trying to
a) Preview results from the "Edit Data Set" dialog
Data engine operation failed due to an unexpected exception.
Error evaluating Javascript expression. Script engine error: ReferenceError:
"IS_EQUAL" is not defined.
Script source: source, line: 0, text:
IS_EQUAL
Reason:
A BIRT exception occurred.
With the detail>>
A BIRT exception occurred.
Plug-in Provider:Eclipse.org
Plug-in Name:BIRT Data Engine
Plug-in ID:org.eclipse.birt.data
Version:2.2.1.r22x_v20070925
Error Code:data.engine.UnexpectedError
Error Message:Data engine operation failed due to an unexpected exception.
Error evaluating Javascript expression. Script engine error: ReferenceError: "IS_EQUAL" is not defined.
Script source: source, line: 0, text:
IS_EQUAL
or
Using the Preview tab from Report Designer
The following items have errors:
ReportDesign (id = 1):
+ Data engine operation failed due to an unexpected exception.
Error evaluating Javascript expression. Script engine error: ReferenceError: "IS_EQUAL" is not defined.
Script source: source, line: 0, text:
IS_EQUAL
None of the documentation seemed to help, and I posted to this forum.
The answer is trivial:
ENCLOSE THE OPERATOR IN DOUBLE QUOTES
So instead of providing the default value for _Operator as IS_EQUAL, specify "IS_EQUAL"
Everything now works fine. I just wonder why the error messages were so cryptic, and no documentation thought to mention you might have to place the operator text in double quotes !
Hopefully this will help others in the same situation.
Thanks
David.
Charlie
Hi David,
I faced similar issue while creating the reports, but I was not able to get this resolution. What I did then was
1. I created the CQ query without anyfilter
2. Then I cretaed the report with parameters and the datasource
3. Then I created the dataset and linked the same to the query
4. Than I used the filter section of the dataset to set filters based on the report parameters.
The catch here is to be careful with the datatype of the report parameters, I used test in most of the cases and converted it to datetime or other if required using javascript function provided by the birt itself.
Regards
Abhishek
Order23
Abhishek,
That's fine, but I didn't want to retrieve all records, just to filter out the one I wanted, though it may give more functionality. However, the method does work - haven't had a chance to create more complex queries yet, but the process should be the same I'm thinking.
Thanks for the reply
David.