Combination View Flat View Tree View
Threads [ Previous | Next ]
Iteration trouble
toggle
Iteration trouble
3/17/09 3:26 PM
Hello,

I've downloaded Inforama Studio this morning and i've been experimenting with it a bit.
I have a MySQL database with a table "participants". This table contains the name, instrument and an ID of players in a band. I've created two datasets in Inforama, "personen" and "eenpersoon". "eenpersoon" has the SQL query "select * from participants where ID = $P{ID}" and it's working fine when i put it in a (fragment of a) letter. The dataset "personen" has the query "select * from participants where instrument = $P{instrument}". My goal is to display all band members that play a certain instrument. When I try to iterate through the result of this query in a letter, it doesn't work. I try iterating ith the following code:

Band members who play the $P{instrument}:

$beginIteration{personen}
- $F{personen.firstName} $F{personen.lastName}
$endIteration{personen}

If I read the manual correctly, this should be the way to do it.
Only i get these(sorry, huge) error:

org.in4ama.documentengine.exception.EvaluationException: Error while creating a
PDF document.
at org.in4ama.documentengine.generator.DocumentEngine.createDocumentFrom
Fop(DocumentEngine.java:646)
at org.in4ama.editor.xui.dialog.JPedalPDFViewerDialog$DocumentLoader.doI
nBackground(JPedalPDFViewerDialog.java:347)
at org.jdesktop.swingworker.SwingWorker$1.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.jdesktop.swingworker.SwingWorker.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.in4ama.documentengine.exception.EvaluationException: Error while
invoking the method: beginIteration
at org.in4ama.documentengine.evaluator.EvaluationHelper.evaluate(Evaluat
ionHelper.java:245)
at org.in4ama.documentengine.evaluator.EvaluationHelper.evaluate(Evaluat
ionHelper.java:118)
at org.in4ama.documentengine.evaluator.EvaluationHelper.getEvaluableCont
ent(EvaluationHelper.java:150)
at org.in4ama.documentengine.evaluator.EvaluationHelper.evaluate(Evaluat
ionHelper.java:71)
at org.in4ama.documentengine.evaluator.EvaluationHelper.evaluateSimple(E
valuationHelper.java:187)
at org.in4ama.documentengine.evaluator.EvaluationHelper.evaluateSimple(E
valuationHelper.java:180)
at org.in4ama.documentengine.evaluator.EvaluationHelper.evaluateSimple(E
valuationHelper.java:180)
at org.in4ama.documentengine.evaluator.EvaluationHelper.evaluateSimple(E
valuationHelper.java:180)
at org.in4ama.documentengine.evaluator.EvaluationHelper.evaluate(Evaluat
ionHelper.java:134)
at org.in4ama.documentengine.evaluator.EvaluationHelper.getXmlEvaluableC
ontent(EvaluationHelper.java:168)
at org.in4ama.documentengine.evaluator.EvaluationHelper.evaluateXml(Eval
uationHelper.java:101)
at org.in4ama.documentengine.generator.DocumentEngine.createDocumentFrom
Fop(DocumentEngine.java:635)
... 8 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.in4ama.documentengine.evaluator.EvaluationHelper.evaluate(Evaluat
ionHelper.java:236)
... 19 more
Caused by: org.in4ama.documentengine.exception.EvaluationException: Unable to ha
ndle the "beginIteration" tag.
at org.in4ama.documentengine.evaluator.handlers.IterationHandler.beginIt
eration(IterationHandler.java:102)
... 24 more
Caused by: java.lang.ClassCastException: org.apache.xerces.dom.DeferredTextImpl
cannot be cast to org.w3c.dom.Element
at org.in4ama.documentengine.evaluator.handlers.IterationHandler.beginIt
eration(IterationHandler.java:72)
... 24 more

It also states that the column "Hobo" (the instrument I put in as parameter) wasn't found. Quite obvious because the column's called "instrument" and the field "Hobo".
Does anyone know what I'm doing wrong here?

Thanks heaps!
RE: Iteration trouble
3/17/09 4:15 PM as a reply to Robbert van Beek.
Hi Robbert,

We changed much of the iteration functionality and the documentation is a little out of date. We'll address this in the coming days.

Can you try replacing...

$beginIteration{personen}
- $F{personen.firstName} $F{personen.lastName}
$endIteration{personen}


with...
$iterateRows{personen}
- $F{personen.firstName} $F{personen.lastName}


You can find more information on this in the Wiki at...
http://in4ama.org/web/guest/community/wiki/-/wiki/Main/Tables

Hope this helps but let me know if you need any more information
Val
RE: Iteration trouble
3/18/09 10:45 AM as a reply to Val Cassidy.
I know i mailed this but so that other people can read it: it's still not working with the other way of iterating...

The strangest thing is that it seems like it's not building up the SQL statement correctly. The statement "select * from participants where instrument = $P{instrument}" is somehow changed to "select * from participants where $P{instrument} (...)" because it tells me if for example i look for the instrument "saxophone" that there's no such column. If I fill in "instrument" then it does run the statement but only one record is shown (the first one).

Is it my database maybe?
Thanks

Robbert
RE: Iteration trouble
3/18/09 11:32 AM as a reply to Robbert van Beek.
Hi Robbert,

It looks like your SQL statement is incorrect. Could you try changing it to...

"select * from participants where instrument = '$P{instrument}'"

Note that the parameter is between single quotes '$P{instrument}'

Val
RE: Iteration trouble
3/18/09 11:54 AM as a reply to Val Cassidy.
Thanks a lot, it's now at least displaying data!

It's not iterating yet but i'll look in to the wiki for that

cheers
RE: Iteration trouble
3/18/09 2:52 PM as a reply to Robbert van Beek.
Hi Robbert,

It should be iterating. If you want to send me the original OpenOffice document I can take a look.

Val
Copyright © 2008 - 2010