Jump to content
Changes to the Jaspersoft community edition download ×

lucianc

Members
  • Posts

    5,609
  • Joined

  • Last visited

  • Days Won

    3

Community Answers

  1. lucianc's post in How to add into server "global" scriptlet for all reports? was marked as the answer   
    What you need to do is to register your scriptlet factory as an extension.
    To do that you'll first need to implement an extension factory like this:
    public class MyStandardScriptletExtension implements ExtensionsRegistryFactory { @Override public ExtensionsRegistry createRegistry(String registryId, JRPropertiesMap properties) { return new SingletonExtensionRegistry<>(ScriptletFactory.class, new MyStandardScriptletFactory()); }}[/code]And then create a file called jasperreports_extension.properties in the root of your jar with the following contents:
    net.sf.jasperreports.extension.registry.factory.my.standard.scriptlet=<my.package>.MyStandardScriptletExtension[/code] 
  2. lucianc's post in Getting the last crosstab value via a measure was marked as the answer   
    Try using calculation="Nothing", that basically keeps the last value.
    Regards,
    Lucian
  3. lucianc's post in Exports for reports containing HTML5 charts suddenly fails was marked as the answer   
    Chromium 111 introduced a couple of incompatibilities with the library used to connect via the DevTools Protocol.
    You can workaround the problem by adding the following properties to WEB-INF/classes/jasperreports.properties:
    net.sf.jasperreports.chrome.page.isolate=truenet.sf.jasperreports.chrome.argument.remote-allow-origins=*[/code]Regards,
    Lucian
  4. lucianc's post in Upgraded from 7.8 to 8.1.1. Report just spins, never gets to asking for Parameter was marked as the answer   
    You report has language="javascript".  The Rhino JavaScript engine has been removed by default in 8.1.0, see https://community.jaspersoft.com/documentation/tibco-jasperreports-server-release-notes/v810/changes-functionality
    You can either add Rhino back into JasperReports Server or change the report to use language="java" as you don't seem to have any expressions that actually use JavaScript syntax.
    Regards,
    Lucian
  5. lucianc's post in Java Error while Preview a Java Report was marked as the answer   
    Set the following two properties under Settings/Jaspersoft Studio/Properties:
    net.sf.jasperreports.chrome.page.isolate=truenet.sf.jasperreports.chrome.argument.remote-allow-origins=*[/code]A background, the problem is caused by Chrome/Chromium 111 introducing changes that makes it incompatible with the library used to connect to the Devtools Protocol.  The two properties above are workarounds for the incompatibilities.
    Regards,
    Lucian
  6. lucianc's post in Need to download Jasperstudio 6.0 was marked as the answer   
    You can find it at https://sourceforge.net/projects/jasperstudio/files/
  7. lucianc's post in Gradle JasperReports Dependency fails to resolve was marked as the answer   
    You need to use https://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts instead of https://jaspersoft.jfrog.io/ui/native/third-party-ce-artifacts
    Regards,
    Lucian
  8. lucianc's post in ERROR: java.lang.ClassNotFoundException: net.sf.jasperreports.functions.FunctionsRegistryFactory was marked as the answer   
    Make sure there are no trailing spaces (after the class name) in jasperreports_extension.properties.
  9. lucianc's post in What could be causing the error class java.lang.String cannot be cast to class java.util.Map? was marked as the answer   
    It looks like you have a parametersMapExpression in your report (under the dataset of a table) that evaluates to a String object instead of a java.util.Map.
    You can check it in Jaspersoft Studio by selecting the table and then looking in the Properties view, Dataset tab, at Parameters Map.  That expression needs to evaluate to a java.util.Map instance.
    Regards,
    Lucian
  10. lucianc's post in Unpatched iText found, cannot use glyph rendering was marked as the answer   
    You can find the iText version patched for glyph rendering here https://jaspersoft.jfrog.io/ui/native/third-party-ce-artifacts/com/lowagie/itext/2.1.7.js6/ (for JasperReports 6.9.0).
    But for cyrillic you shouldn't normally need glyph rendering, using a font extension should be enough.  See for instance the Unicode sample report.
    Regards,
    Lucian
  11. lucianc's post in how to use JRExportProgressMonitor in JRPdfExporter was marked as the answer   
    You can set a JRExportProgressMonitor in SimpleReportExportConfiguration.
  12. lucianc's post in ClassCast Exception when converting single-element Collection to String was marked as the answer   
    I assume you don't have an input control defined for the issue-status-filter parameter in the server report unit.
    The recommended solution is to create a multi valued input control for the parameter.  The input control can be either backed by a query (something like select distinct status from ... in your case) or by a static values list (if there's a fixed set of status values).
    I would also recommeng using $X{IN,status,issue-status-filter} instead of manually constructing the status in (...) clause with String.join.  For one, $X{IN} protects you from SQL injection.
    If for some reason you don't want to create an input control, your only chance is to write the parameter so it works with both single values and collections of values.  Something like this:
    <parameter name="issue-status-filter" class="java.lang.Object" /> <parameter name="issue-status-filter-list" class="java.util.List" isForPrompting="false"> <defaultValueExpression> ($P{issue-status-filter} == null) ? null : (($P{issue-status-filter} instanceof Collection) ? new ArrayList((Collection) $P{issue-status-filter}) : Collections.singletonList($P{issue-status-filter})) </defaultValueExpression> </parameter>[/code]Then you can use issue-status-filter-list for the query.  It's not pretty but I don't see any other way.
    Regards,
    Lucian
  13. lucianc's post in Jasper Report: Pie chart without dataLabels was marked as the answer   
    Boolean chart property values should be provided as expressions.  Values set using the static attribute are passed as strings (and probably converted to booleans using JavaScript rules).
    <hc:chartProperty name="plotOptions.pie.dataLabels.enabled"> <hc:propertyExpression>false</hc:propertyExpression> </hc:chartProperty>[/code]Regards,
    Lucian
  14. lucianc's post in How to change dpi on server level was marked as the answer   
    What you need to do is add the following line to WEB-INF/classes/jasperreports.properties:
    net.sf.jasperreports.image.dpi=300[/code]A server restart is required.
    Regards
    Lucian
  15. lucianc's post in How to exclude page header of a jasper report xls export in Jasper server? was marked as the answer   
    The reason for which it doesn't work in JRS is that there's a global property that excludes page headers from Excel exports, but with a flag to keep the first header.  If you look in WEB-INF/classes/jasperreports.properties you'll see the following line:
    net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.1=pageHeader
    This property gets to override the property from the report (which is not exactly normal).  Try commenting/deleting the property in jasperreports.properties and retesting your report (after a server restart).
    Regards,
    Lucian
  16. lucianc's post in Sorting subreport fields using multiple references to the same datasource was marked as the answer   
    You can use something like /PAGE/DATA/*/ITEM as XPath query, and then map a field to ORDER/ORD and use it as sort field:
    <?xml version="1.0" encoding="UTF-8"?><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="xml_data" pageWidth="995" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20"><queryString language="XPath">/PAGE/DATA/*/ITEM</queryString><field name="ITEM_NAME"> <fieldDescription>ITEM_NAME</fieldDescription></field><field name="ORD" class="java.lang.Integer"> <fieldDescription>ORDER/ORD</fieldDescription></field><sortField name="ORD"/><detail> <band height="20"> <textField> <reportElement width="200" y="0" x="0" height="20"/> <textFieldExpression>$F{ITEM_NAME} + " " + $F{ORD}</textFieldExpression> </textField> </band></detail></jasperReport>[/code]Regards,
    Lucian
  17. lucianc's post in Assigning multiple series to secondary axis on HTML5 Multi-axis Chart was marked as the answer   
    You can explicitly create Y axes and assign series to specific axes.
    See the attached sample report: the yAxis chart settings creates a new axis (_jrAxisIndex=1 means it's the second axis) and sets some properties for it, and SeriesProperty contributors set the series types and assings the series to the second axis.
    Regards,
    Lucian
  18. lucianc's post in Subreport in Table Cell won't see Fields/Parameters was marked as the answer   
    Jaspersoft Studio proposing main dataset fields/variables is a bug, consider filing it in the trackers.
    But a proper expression using the table dataset seems to work fine to me.  Do you have a self contained example to reproduce the problem that you found?
    Thank you,
    Lucian
  19. lucianc's post in Use lamda expression in .jrxml file for jasper report was marked as the answer   
    Lambda expressions in reports work with a recent JDT compiler jar (e.g. 4.5.1 from Maven http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.eclipse.jdt.core.compiler%22%20AND%20a%3A%22ecj%22) and with the following properties in jasperreports.properties:
    org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8org.eclipse.jdt.core.compiler.compliance=1.8org.eclipse.jdt.core.compiler.source=1.8 It also works with the 1.8 javac compiler used for reports, but using the JDT compiler is the recommended setup. Regards,Lucian 
  20. lucianc's post in PDF encoding - Not printing characters on export was marked as the answer   
    You need to use a font that includes glyphs for Romanian characters.  The one used in the article example doesn't.
    If you don't have a specific font that you want to use, you can use DejaVu Sans which is bundled in jasperreports-fonts.jar (you can get it from https://sourceforge.net/projects/jasperreports/files/jasperreports/JasperReports%206.3.0/).
    Regards,
    Lucian
  21. lucianc's post in Excel export with subreports does not work was marked as the answer   
    What you need to avoid for Excel and other grid based exporters is overlapping elements.  Such exporters are inherently unable to export multiple elements that occupy the same space, therefore overlapped elements are skipped.  This is the main culprit for elements missing in Excel exports.
    Regards,
    Lucian
  22. lucianc's post in stretch a textfield only vertical? was marked as the answer   
    Try setting the net.sf.jasperreports.export.html.wrap.break.word property to true.
    An alternative solution is to set the net.sf.jasperreports.text.save.line.breaks property instead.
  23. lucianc's post in Convert Groovy expression into Java expression in Studio 6.0.0 was marked as the answer   
    I don't think directly converting the expression to Java is possible.  For one, Groovy allows calling void methods in expressions (evaluating to null) but in Java there's no way to call a void method (such as Calendar.set or Calendar.add) in an expression.
    One alternative is to write a method in a utility class (or create a custom function in Jaspersoft Studio), and use it in the expression.  Cramming too much logic in an expression is not generally a good idea, having it implemented externally would allow you to do more things, reuse it, etc.
    Regards,
    Lucian
  24. lucianc's post in ExtensionRegistry and OSGi was marked as the answer   
    Yes, ExtensionsEnvironment.setSystemExtensionsRegistry sets a global extensions registry.
    If you want to set a registry for the current thread only, you can use ExtensionsEnvironment.setThreadExtensionsRegistry.
    Another option is to create a JasperReportsContext instance (for example SimpleJasperReportsContext), set the extensions in the context and use it for all the JR calls.
    Regards,
    Lucian
  25. lucianc's post in How to set IS_USING_IMAGES_TO_ALIGN in HtmlExporter in Java ? was marked as the answer   
    The new HtmlExporter does not support using images for alignment.  So you no longer need to set IS_USING_IMAGES_TO_ALIGN to false, it is false by default.
    Regards,
    Lucian
×
×
  • Create New...