Home
Analytics
How to update data in a dataset?
tonkadawg
I've got a report with a few datasets defined and it's working somewhat as expected. Some of the data coming back is encrypted and needs to be decrypted before the report is displayed.
I've created a java event handler for both the dataset as well as the text object in the report. I'm able to decrypt the values as needed, but I'm unable to bind those decrypted values to the report.
Using BIRT 2.2.2.
Please help!
TIA
Find more posts tagged with
Comments
bhanley
How about using a scripted data source? In a scripted data source you build a Java object to access and prepare your data and then you are able to use that object as a data source in your report. This would enable your data to be decoded successfully prior to it hitting the BIRT tier.<br />
<br />
Here is a really easy to follow example to get you started if this path seems like a valid one to you: <a class='bbc_url' href='
http://www.birt-exchange.org/devshare/designing-birt-reports/544-sample-birt-scripted-data-source-example/#description'>Sample
BIRT Scripted Data Source Example - Designs & Code - BIRT Exchange</a>
tonkadawg
<blockquote class='ipsBlockquote' data-author="bhanley"><p>How about using a scripted data source? In a scripted data source you build a Java object to access and prepare your data and then you are able to use that object as a data source in your report. This would enable your data to be decoded successfully prior to it hitting the BIRT tier.<br />
<br />
Here is a really easy to follow example to get you started if this path seems like a valid one to you: <a class='bbc_url' href='
http://www.birt-exchange.org/devshare/designing-birt-reports/544-sample-birt-scripted-data-source-example/#description'>Sample
BIRT Scripted Data Source Example - Designs & Code - BIRT Exchange</a></p></blockquote>
<br />
<br />
This is an excellent idea and I think it will work. Wish I would have thought to post a thread about 2 days ago.<br />
<br />
I do have one more question - I've created the scripted data set and my java object. Right now I'm just returning dummy data. My java object is getting called, but the dummy data isn't appearing on the report. I have added the scripted data set attribute to the report, it appears to be bound correctly. Any ideas what I'm missing?<br />
<br />
again, thanks!
bhanley
How are you trying to render the data? A table? A chart? Ensure the new Data Set you have created is in fact bound to the rendering mechanism.
Also check that you can preview the data on the Data Set editor window.
tonkadawg
I just dropped the scripted data set attribute on the report - it's not in a table or row or anything like that.
tonkadawg
here's the code:
the pojo:
public Vector getUser() {
System.out.println("****** getUser() ******");
Vector data = new Vector();
data.add(new String[]{"user", "user","user", "user", "user", "user"});
return data;
}
the open function on the scripted data set:
decryptedUsers = new Packages.com.tayloredwebsites.common.UserScriptedDataSource
users = decryptedUsers.getUser();
totalrows = users.size();
currentrow = 0;
and the fetch function on the scripted data set:
if( currentrow >= totalrows ){
return( false );
}
var decryptedUsers = users.get(currentrow);
var user = decryptedUsers[0];
name=user;
currentrow = currentrow + 1;
return ( true );
and like I said in my last post, I just dropped the 'name' attributed from the scripted data set on to the report.
No errors, but I'm not seeing the "user" value on the report.
tonkadawg
alright figured it out.
in the fetch function I wasn't specifying a row in the data set:
name=user;
needs to be row["name"]=user;