olidel2003 Posted November 24, 2006 Share Posted November 24, 2006 Hi,Answer is problably easy but... I've not found how to do this :( From a Java app, I get a compliant JRDataSource object which contains fields (1 row, several fields). One of the fields is a JRDataSource too (for example SubElementsField) and it contains several rows and for each row several fields (for example SubElementField1). ExampleMainDataSource--Field1 (String)--Field2 (String)--SubElementsField (JRDataSource)-----SubElementField1 If I put a subreport in my main report with datasource SubElementsField, I can access in the subreport the field $F{SubElementField1} with this very easy syntax. Now, what I want to do is to be able to access to SubElementField1 in my MAIN report through a syntax like $F{SubElementsField}[0]_F{SubElementField1}... How can I do this... I don't want a sub-report, I just want to access the 3th field of the 1st row of SubElementsField in my main report (for example). Which syntax can I use?Thanks a lot. Link to comment Share on other sites More sharing options...
C-Box Posted November 24, 2006 Share Posted November 24, 2006 Just create your own CustomDataSource and write your own public method that returns the fieldvalue of a given row number. something like (just PseudoCode): Code:public Object getFieldValueByRowNumber(int rowNumber,String fieldName){ if (rowNumber>=0 && rowNumber <= datsource.getRecordCount() && fieldExist(fieldName){ return getRow(rowNumber).getFieldValue(fieldName);}} quite easy (IMHO). regards + hthC-Box Link to comment Share on other sites More sharing options...
olidel2003 Posted November 27, 2006 Author Share Posted November 27, 2006 Thanks for the answer, I will do something like this. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now