Jump to content
We've recently updated our Privacy Statement, available here ×

Iterating Data in Detail Section


2005 IR Help

Recommended Posts

By: flux - fluxz

Iterating Data in Detail Section

2004-03-26 00:03

Hi

Sorry I post this thread here i think its more an iReport issue but i received no response posting a thread on their forum.

I've made some (basic) reports using iReports. Now i need to iterate data in the detail section of my report ( this means i' m looping data in a loop(detail) . Like This :

______

Data1 |

_____ |

Data2 |

Data2 |

Data2 |

-------

Data1 |

_____ |

Data2 |

Data2 |

-------

Now at this point i am able to fill Data1 one with this code (using Custom JRDataSource ) :

 

if("Data1".equals(fieldname))

value = customerDTO.getName() ;

 

I've tried to make a subreport where i've put Data2 in the Detail section. (This Data2 uses its own Custom JRDataSource. )

I can call the subreport using the tab "SubReport(other)" and locate my subreport with a String.

(I see my static text but i don't see my variables ).

But asigning my Custom DataSource doesnt work.

this is what i've got in my .xml

 

<parameter name="MyDataSource" isForPrompting="true" class="datasource.SubReportDataSource"/>

<parameter name="SubReportParam" isForPrompting="true" class="java.lang.String">

<defaultValueExpression ><![CDATA["C:\Backup\workspace\PoleConseil\WebContent\reports\SubReport.jasper"]]></defaultValueExpression>

</parameter>

 

Does anyone know how to solve this problem? Do i need to work with subreports or do i need to work with groups? ( if so would you mind sharing some code snippets? )

 

help appriciated.

 

 

 

 

By: David Lim - aberrant80

RE: Iterating Data in Detail Section

2004-03-26 01:18

I don't really understand how you want your report to look. And I don't think I understand the iReport part either; but I do understand that you're trying to pass a data source to a subreport as a parameter, right?

 

I can only suggest you do something like this:

 

<parameter name="SubrepDS" class="JRDataSource.class">

...

<subreport>

...

<dataSourceExpression>

$P{SubrepDS}

</dataSourceExpression>

</subreport>

 

 

and in your subreport, you can just use the default $P{REPORT_DATA_SOURCE}

 

 

 

 

By: flux - fluxz

RE: Iterating Data in Detail Section

2004-03-26 01:56

Basically i want data2 depending on data1. These two (sets of) variables have to be in the detail section.

A little example: for each customer i have a name, an Id and a relation type.

This can be represented as Data1.

I didn't encounter any problems filling Data1.

Now for each Data1, I have several variables like productNumber, Year, Intrests,... represented by Data2.

So briefly i have 2 loops.

Data1 and for each Data1 i have to get (multiple ) Data2 .

I've tried passing a custom JRDataSource through parameters as you discribe in your post. But i get a classNotFound error, eventhough i placed te .xml in the same folder as the JRDataSource.class file.

I'm wondering about groups and subreports.

Like i said in previous post, displaying the Static text is no problem. But variables are not shown. (Not even with a null value ).

I hope this clearifies my problem a bit.

 

 

 

 

 

By: David Lim - aberrant80

RE: Iterating Data in Detail Section

2004-03-28 18:44

no null may mean that your text field may be too small. set height or width to > 0, and set the stretch attributes.

 

as for your report, i think you can try using your data1 for your group. so, something like $P{name} for your group expression, and display whatever data1 stuffs you want in the group header.

 

then leave your data2 stuff in the detail band. try first, i'm not too sure.

 

 

 

 

By: flux - fluxz

RE: Iterating Data in Detail Section

2004-03-29 00:36

David,

 

I can see my null values in my subreport. The problem occurs when displaying the subReport in the master. The problem isn't the size of my text field. I wish it was that simple :( . So i think there's an other problem involved showing variables.

 

As for the report, i've tried putting in a subgroup. But doing this causes a layout problem. ( Group band and detail band are placed over eachother.)

 

As for my master DataSource i have to tell the report how many times it should repeat filling the groupband.

For the detail band this works perfectly with the next() method designed in the JRDataSource interface. But i have no idea how to do this with a subgroup.

 

I'm getting desperate....

 

 

 

 

 

 

 

By: C-Box - c-box

RE: Iterating Data in Detail Section

2004-04-28 23:21

Hi fluxz,

 

Have you found a solution for showing just the data2 that are related to each data1?

 

C-Box

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...