show display text of dynamic parameter on report [message #144781] |
Thu, 16 March 2006 21:58 |
Eclipse User |
|
|
|
Originally posted by: vladperl.semanticprogrammer.org
I have dynamic parameter called "departmentID" that get value (id) from
dataset "departments".
Dataset "departments" use query: "select id, name from Departments".
How can I get department name from selected row of "departments" dataset?
I need to present name of department on report .
Thank you,
Vladimir
|
|
|
|
Re: show display text of dynamic parameter on report [message #145412 is a reply to message #144848] |
Fri, 17 March 2006 15:58 |
Eclipse User |
|
|
|
Originally posted by: vladperl.semanticprogrammer.org
Hi David,
Thank you for response.
> I'm not totally sure what you're asking, but I think you just want to
> create the parameter as a dynamic combo box with ID and name, then you can
> access directly as
>
> params["Name"]
I have tried that. It doesn't work.
Here is my parameter:
<scalar-parameter name="departmentID" id="11">
<property name="valueType">dynamic</property>
<property name="dataType">decimal</property>
<property name="promptText">Department</property>
<property name="format">Unformatted</property>
<property name="controlType">list-box</property>
<property name="dataSetName">departments</property>
<expression name="valueExpr">row["ID"]</expression>
<expression name="labelExpr">row["Name"]</expression>
<property name="mustMatch">true</property>
<property name="fixedOrder">true</property>
<property name="defaultValue">9</property>
</scalar-parameter>
------------------------------------------------------------ -
here is "departments" DataSet:
<oda-data-set
extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet "
name="departments" id="6">
<property name="dataSource">midwood</property>
<property name="queryText">select ID, Name
from dbo.Department
order by name</property>
</oda-data-set>
I need to show selected department name.
Thank you,
Vladimir
|
|
|
Re: show display text of dynamic parameter on report [message #145539 is a reply to message #145412] |
Fri, 17 March 2006 18:23 |
Eclipse User |
|
|
|
Originally posted by: David.Peterson.mtvnmix.com
<I need to show selected department name.>
I see what you're asking now. The parameter is really the department id.
You don't really have a handle to the combo parameter 'name' part. You have
params["department-id"], but nothing for params["department-name"] as it's
displayed to the user, but it isn't a param per se.
What I do is a bit different. I use the DepartmentID to index into my
departments table to return a dataset for my report. As part of that, I
also return the department-name in dataset query even though I may not
actually need it for the report. Then I display that in my report header as
row["department-name"]. Will this work for you?
So what I have is actually two datasets:
1. dataset departments which is used to form the parameter with query:
select ID, Name from dbo.Department order by name.
2. dataset department which is used in my actual report with query: select
ID, Name from dbo.Department where ID=? <bound to parameter DepartmentID>
and used to display the department name in my report.
is this clear?
|
|
|
Re: show display text of dynamic parameter on report [message #145582 is a reply to message #145539] |
Fri, 17 March 2006 18:54 |
Eclipse User |
|
|
|
Originally posted by: vladperl.semanticprogrammer.org
> I see what you're asking now. The parameter is really the department id.
> You don't really have a handle to the combo parameter 'name' part. You
> have params["department-id"], but nothing for params["department-name"] as
> it's displayed to the user, but it isn't a param per se.
>
> What I do is a bit different. I use the DepartmentID to index into my
> departments table to return a dataset for my report. As part of that, I
> also return the department-name in dataset query even though I may not
> actually need it for the report. Then I display that in my report header
> as row["department-name"]. Will this work for you?
>
> So what I have is actually two datasets:
>
> 1. dataset departments which is used to form the parameter with query:
> select ID, Name from dbo.Department order by name.
>
> 2. dataset department which is used in my actual report with query:
> select ID, Name from dbo.Department where ID=? <bound to parameter
> DepartmentID> and used to display the department name in my report.
>
> is this clear?
Yes it's clear. In fact I use the same approach as you.
Only instead of second query I'm using "getDepartmentByID" stored procedure
with related parameter.
But it doesn't look for me as elegant solution.
We have to use additional dataset and additional report item such as table
with additional parameter bounding just to work out the issue.
I have suggestion to file enhancement. What do you think?
In case you agree with me on this, please make enhancement.
I will add comments later to show them it's not just one developer who need
that enhancement.
Thank you,
Vladimir
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04095 seconds