Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Access dataSet ColumnValue(Access dataSet ColumnValue via Java Code)
Access dataSet ColumnValue [message #793709] Wed, 08 February 2012 13:12 Go to next message
William Tchatchueng is currently offline William TchatchuengFriend
Messages: 5
Registered: February 2012
Junior Member
hi,

i have a scriptdataset with a column named "ServiceProviderID" and i set the value via fetch-method

updatableDataSetRow.setColumnValue("ServiceProviderID", sp.getID());


In another place of the java application, i want to retrieve this value. how can i do this via javacode?

here is how i startet, but now aint know how to continue

ReportDesignHandle reportDesignHandle = reportContext.getDesignHandle();
	
	List<DesignElementHandle> list = reportDesignHandle.getDataSets().getContents();
	for (DesignElementHandle designElementHandle : list) {
	    DataSetHandle dataSetHandle = (DataSetHandle) designElementHandle;
	    if ("Data Set".equalsIgnoreCase(dataSetHandle.getName())) {
		DesignElement elt = dataSetHandle.getElement();
		if (elt instanceof ScriptDataSet) {
		    ScriptDataSet scriptDataSet = (ScriptDataSet) elt;
		    IElementDefn eltDefn = scriptDataSet.getDefn();
		}
	    }
	}


thanks a lot
Re: Access dataSet ColumnValue [message #793921 is a reply to message #793709] Wed, 08 February 2012 18:40 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

The code you listed is the DE API for getting design values not runtime
values. Can you give some more details one what you are trying to do?
Is this app web based, client/server?

Jason

On 2/8/2012 8:12 AM, William Tchatchueng wrote:
> hi,
>
> i have a scriptdataset with a column named "ServiceProviderID" and i set
> the value via fetch-method
>
>
> updatableDataSetRow.setColumnValue("ServiceProviderID", sp.getID());
>
>
> In another place of the java application, i want to retrieve this value.
> how can i do this via javacode?
>
> here is how i startet, but now aint know how to continue
>
>
> ReportDesignHandle reportDesignHandle = reportContext.getDesignHandle();
>
> List<DesignElementHandle> list =
> reportDesignHandle.getDataSets().getContents();
> for (DesignElementHandle designElementHandle : list) {
> DataSetHandle dataSetHandle = (DataSetHandle) designElementHandle;
> if ("Data Set".equalsIgnoreCase(dataSetHandle.getName())) {
> DesignElement elt = dataSetHandle.getElement();
> if (elt instanceof ScriptDataSet) {
> ScriptDataSet scriptDataSet = (ScriptDataSet) elt;
> IElementDefn eltDefn = scriptDataSet.getDefn();
> }
> }
> }
>
>
> thanks a lot
Re: Access dataSet ColumnValue [message #794004 is a reply to message #793921] Wed, 08 February 2012 20:30 Go to previous messageGo to next message
William Tchatchueng is currently offline William TchatchuengFriend
Messages: 5
Registered: February 2012
Junior Member
HI Jason,

I have a report with 2 tables... the first table has 2 detailrows and the second table and is placed inside the second detailrow of the first table.

the first table have to display a serviceprovider and the second table show the description (details) for each serviceprovider.

i used a scripted datasource. this is a java class who give a call to a webservice to get the data. i've tried to get this webservice as datasource, but it couldnt work because birt got a problem to find and show the results.

Any way, i decide to use this java class as datasource and make the webservice calls through this class.

for the first table has 2 detail row, one for the serviceprovider and one for the second table for displaying the details.

The workflow is like this. the java class make the first webservice call to get the serviceprovider, fill the row and then make a second call with the serviceproviderid to get the details to fill the second table and so on.

I hope u can feel me

thanks
William
Re: Access dataSet ColumnValue [message #794012 is a reply to message #794004] Wed, 08 February 2012 20:37 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

William

Are you using a data set parameter for the nested table?
Take a look at this example video:
http://download.eclipse.org/birt/downloads/examples/reports/2.1/subreport/subreport.html


Jason

On 2/8/2012 3:30 PM, William Tchatchueng wrote:
> HI Jason,
>
> I have a report with 2 tables... the first table has 2 detailrows and
> the second table and is placed inside the second detailrow of the first
> table.
>
> the first table have to display a serviceprovider and the second table
> show the description (details) for each serviceprovider.
> i used a scripted datasource. this is a java class who give a call to a
> webservice to get the data. i've tried to get this webservice as
> datasource, but it couldnt work because birt got a problem to find and
> show the results.
>
> Any way, i decide to use this java class as datasource and make the
> webservice calls through this class.
>
> for the first table has 2 detail row, one for the serviceprovider and
> one for the second table for displaying the details.
>
> The workflow is like this. the java class make the first webservice call
> to get the serviceprovider, fill the row and then make a second call
> with the serviceproviderid to get the details to fill the second table
> and so on.
>
> I hope u can feel me
>
> thanks William
Re: Access dataSet ColumnValue [message #794022 is a reply to message #794012] Wed, 08 February 2012 21:04 Go to previous messageGo to next message
William Tchatchueng is currently offline William TchatchuengFriend
Messages: 5
Registered: February 2012
Junior Member
hi Jason,

i dont use a dataset parameter for the nested table. i use java event handler for the two datasets (open or beforeOpen, fetch)... i dont know how to read this dataset parameter (e.g. serviceproviderid) from java code and if i have to make a webservicecall with serviceproviderid to get the serviceprovider details for each row and fill and show the data.

thanks a lot
William
Re: Access dataSet ColumnValue [message #794041 is a reply to message #794022] Wed, 08 February 2012 21:34 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

If you create a data set parameter on the nested table and set it in the
binding like the video showed, you can access its value in Java in the
beforeOpen like:

dataSet.getInputParameters().get("param_1");

Jason

On 2/8/2012 4:04 PM, William Tchatchueng wrote:
> hi Jason,
>
> i dont use a dataset parameter for the nested table. i use java event
> handler for the two datasets (open or beforeOpen, fetch)... i dont know
> how to read this dataset parameter (e.g. serviceproviderid) from java
> code and if i have to make a webservicecall with serviceproviderid to
> get the serviceprovider details for each row and fill and show the data.
>
> thanks a lot
> William
Re: Access dataSet ColumnValue [message #794055 is a reply to message #794041] Wed, 08 February 2012 21:56 Go to previous messageGo to next message
William Tchatchueng is currently offline William TchatchuengFriend
Messages: 5
Registered: February 2012
Junior Member
Hi Jason,

i've read in a book that is not possible to get the inputParameter of a ScriptedDataSet over a Java Event handler, just over Rhino Javascript... that why i didnt use a dataset parameter

thanks
William
Re: Access dataSet ColumnValue [message #794078 is a reply to message #794055] Wed, 08 February 2012 22:23 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I believe that issue has been resolved.

Jason

On 2/8/2012 4:56 PM, William Tchatchueng wrote:
> Hi Jason,
>
> i've read in a book that is not possible to get the inputParameter of a
> ScriptedDataSet over a Java Event handler, just over Rhino Javascript...
> that why i didnt use a dataset parameter
>
> thanks
> William
Re: Access dataSet ColumnValue [message #794412 is a reply to message #794078] Thu, 09 February 2012 08:55 Go to previous messageGo to next message
William Tchatchueng is currently offline William TchatchuengFriend
Messages: 5
Registered: February 2012
Junior Member
No Message Body

[Updated on: Thu, 09 February 2012 09:22]

Report message to a moderator

Re: Access dataSet ColumnValue [message #794804 is a reply to message #794412] Thu, 09 February 2012 18:11 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

You can not get it from the reportContext object. You have to use the
dataSet object.

public void beforeOpen(IDataSetInstance dataSet,
IReportContext reportContext) throws ScriptException {

Object val = dataSet.getInputParameters().get("param_1");


Jason

On 2/9/2012 3:55 AM, William Tchatchueng wrote:
> Hi Jason,
>
> if this issue has been resolved, can u please tell me how to get this
> inputParameter if i have a reportContext-Object.
>
> thanks.
> William
>
>
> Jason Weathersby wrote on Wed, 08 February 2012 17:23
>> I believe that issue has been resolved.
>>
>> Jason
>>
>> On 2/8/2012 4:56 PM, William Tchatchueng wrote:
>> > Hi Jason,
>> >
>> > i've read in a book that is not possible to get the inputParameter of a
>> > ScriptedDataSet over a Java Event handler, just over Rhino
>> Javascript...
>> > that why i didnt use a dataset parameter
>> >
>> > thanks
>> > William
>
>
Previous Topic:Chart Report For Work Schedules
Next Topic:How to dynamically generate column heading and avoid outof memeory issue
Goto Forum:
  


Current Time: Thu Apr 18 08:24:33 GMT 2024

Powered by FUDForum. Page generated in 0.03885 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top