java - What is jasper report's algorithm for using a data source? -
i have created custom data source implementing interface jrdatasource. interface looks this:
public interface jrdatasource { /** * tries position cursor on next element in data source. * @return true if there next record, false otherwise * @throws jrexception if error occurs while trying move * next element */ public boolean next() throws jrexception; /** * gets field value current position. * @return object containing field value. object type must * field object type. */ public object getfieldvalue(jrfield jrfield) throws jrexception; }
my question following: in way jasper report call functions obtaining fields in .jrxml.
e.g:
if( next() )){ call getfieldvalue every field present in page header while( next() ){ call getfieldvalue every field present in detail part } call getfieldvalue every field present footer }
the previous example, experimentally in fact found out not that. question arised.
thanks!
i think algorithm (simplifying way down , using java syntax):
while(datasource.next()) { (jrfield field : reportfields) currentvalues.put(field, datasource.getfieldvalue(field)); }
fields declared in jrxml file independently of displayed.
however, best of knowledge, default detail section generated (drawn or updated) on per-record basis. in other words, you'll have fancy if need update information in header or footer of page.
i believe there evaluationtime
attribute can used in several elements might helpful in regard or may want subreport features, depending on how data need work with.
personally, i've found jasperreports sample projects helpful, though require effort out of them. i'd point the definitive guide jasperreports name lie, serve decent (and otherwise totally lacking) reference manual.
Comments
Post a Comment