Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The name the Table-Model is registered with the report-data-factory must be the same as the query-name used in the report-object.

How can I format the output of number fields?

formating is now handled by the style system. So if you pass in a number or date object, it can be formated using a style rule. OK, no one wants to declare own rules, so there are some sane defaults:

This is the snipped of the default stylesheet that is responsible for formating values:

Code Block

@namespace url(http://jfreereport.sourceforge.net/namespaces/reports/flow);
@namespace xml url(http://www.w3.org/XML/1998/namespace);
@namespace report url(http://jfreereport.sourceforge.net/namespaces/engine);

content[report|content] {
  content: attr("report|content");
  display: inline;
}

content[report|content][report|isDate=true] {
  content: format(attr("report|content", date), date);
}

content[report|content][report|isDate=true][report|format] {
  content: format(attr("report|content", date), date, attr("report|format",string));
}

content[report|content][report|isNumber=true] {
  content: format(attr("report|content", number), number, "#,##0.00");
}

content[report|content][report|isNumber=true][report|format] {
  content: format(attr("report|content", number), number, attr("report|format",string));
}

content[report|content][report|isNumber=true][report|isInteger=true] {
  content: format(attr("report|content", number), number, "#,##0");
}

content[report|content][report|isNumber=true][report|isInteger=true][format] {
  content: format(attr("report|content", number), number, attr("report|format",string));
}


In common wording: If you have an "flow:content" element (where flow is a namespace identifier pointing to the namespace uri "http://jfreereport.sourceforge.net/namespaces/reports/flow") that has a 'format' attribute, then the engine will take the value from the 'content' element's content attribute and format the value found there with the formatstring found in the 'format' attribute. The attributes of the namespace 'report' are automaticly filled in by the engine itself, you dont have to care about where they come from, simply assume that they are there whenever you refer to a ContentElement.

Example:

Code Block

<report:report xmlns:report="http://jfreereport.sourceforge.net/namespaces/reports/flow">

  ..

      <report:content>
        <report:value-expression formula="jfreereport:12345678" format="#.##0.00"/>
     </report:content>

</report:report>