amonse Posted December 21, 2016 Share Posted December 21, 2016 Hello,I need to define a variable path to a Style Templet. The path is affected by a parameter. I tried it with Styles > Add Style Template Reference > Custom expression (...) but in this expression all uses of functions or variables results in failure.I figured out that functions are not evaluated nor are variables.Is there a way to get this working or does someone know a workaround? Link to comment Share on other sites More sharing options...
lucianc Posted December 21, 2016 Share Posted December 21, 2016 Variables do not work because style templates are loaded before variables are initialized. Functions and parameters should work fine.If you have an example with a function not working in a style template expression, post a full JRXML to reproduce the problem (and detail what "results in failure" means).Regards,Lucian Link to comment Share on other sites More sharing options...
amonse Posted December 21, 2016 Author Share Posted December 21, 2016 Results in failure means, that I got a message window with "The selected resource is not a valid template style".I construct a little sample. Below is the jrxml file. With the FLOOR function, jasper is unable to find the style template. Without a function everything works fine.<?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.3.1.final using JasperReports Library version 6.3.1 --><!-- 2016-12-21T13:41:19 --><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="TEST" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="dacf0ab0-76b4-42bf-b619-531bbc6f3a4e"> <template><![CDATA[(FLOOR(4.5 ) == 4.0) ? "C:\Users\amonse\JaspersoftWorkspace\MyReports\TEST_STYLE.jrtx" : "C:\Users\amonse\JaspersoftWorkspace\MyReports\TEST_STYLE.jrtx"]]></template> <queryString> <![CDATA[]]> </queryString> <background> <band splitType="Stretch"/> </background> <title> <band height="79" splitType="Stretch"/> </title> <pageHeader> <band height="35" splitType="Stretch"/> </pageHeader> <columnHeader> <band height="61" splitType="Stretch"/> </columnHeader> <detail> <band height="125" splitType="Stretch"> <textField> <reportElement x="135" y="53" width="100" height="30" uuid="15d1ebaf-30ab-4c1b-afbc-34789b8f8fb1"/> <textFieldExpression><![CDATA[FLOOR(4.5)]]></textFieldExpression> </textField> </band> </detail> <columnFooter> <band height="45" splitType="Stretch"/> </columnFooter> <pageFooter> <band height="54" splitType="Stretch"/> </pageFooter> <summary> <band height="42" splitType="Stretch"/> </summary></jasperReport>[/code] Link to comment Share on other sites More sharing options...
lucianc Posted December 22, 2016 Share Posted December 22, 2016 The style template expressions works fine when you run the report, but it does seem that Jaspersoft Studio has a problem with it in design mode.I suggest you to log a bug for Studio in the project Trackers. Link to comment Share on other sites More sharing options...
amonse Posted December 22, 2016 Author Share Posted December 22, 2016 Bug added to the Tracker:http://community.jaspersoft.com/jaspersoft-studio/issues/9031 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now