Jump to content
We've recently updated our Privacy Statement, available here ×

anderl

Members
  • Posts

    3
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Security Advisories

Downloads

Everything posted by anderl

  1. Thank you for your response. I'm using Jaspersoft Studio 6.5.1. The first java file named unilimeFunctions: package unilimeFunctions;import net.sf.jasperreports.functions.annotations.Function;import net.sf.jasperreports.functions.annotations.FunctionCategories;import net.sf.jasperreports.functions.annotations.FunctionParameter;import net.sf.jasperreports.functions.annotations.FunctionParameters;import java.text.DecimalFormat;@FunctionCategories({ UnilimeReportFunctions.class })public class UnilimeFunctions { @Function("ROUND_MW") @FunctionParameters({ @FunctionParameter("DecimalNumber"), @FunctionParameter("DecimalPlaces")}) public static Double ROUND_MW(Double DecimalNumber, Integer DecimalPlaces) { DecimalFormat df = new DecimalFormat(); return 15.0; } @Function("HELLO_WORLD_MSG") public static String HELLO_WORLD_MSG() { return "Hello World!"; } @Function("REPEAT_MSG") @FunctionParameters({ @FunctionParameter("message"), @FunctionParameter("times"), @FunctionParameter("forceUpperCase") }) public static String REPEAT_MSG(String message, Integer times) { return REPEAT_MSG(message, times, false); } public static String REPEAT_MSG(String message, Integer times, Boolean forceUpperCase) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < times; i++) { sb.append(message).append("n"); } String txt = sb.toString(); if (forceUpperCase) { txt = txt.toUpperCase(); } return txt; }}[/code]The second one, unilimeReportFunctions, is empty. As mentioned before: This is the output that I got from following the tutorial. I only added the function ROUND_MW
  2. I tried to add new function to my Report in Jaspersoft Studiop according to the tutorial: Expression Editor how to extend it and contribute your own functions. With this Method Jaspersoft studio adds some example Function too and I wanted to begin by adding my functionen to the .java files provided but it doesn't work. Either my expressions don't show up or the expression editor does not work at all. I even had to reinstall the JRE to fix the expression editor after one attempt. What I tried: -rebuilding the whole Report directory by pressing ctrl+b -constructing it completely from scratch -Adding it to one of the files provided by the wizard (New->other->Funtion package) in the source folder I think it has something to do with the compiling process but I#m not sure and I don't know how to make Jaspersoft studio to compile my files. My code and my outline below. ROUND_MW is the function I wanted to add. The function is far from complete but it should be valid code. package unilimeFunctions;import net.sf.jasperreports.functions.annotations.Function;import net.sf.jasperreports.functions.annotations.FunctionCategories;import net.sf.jasperreports.functions.annotations.FunctionParameter;import net.sf.jasperreports.functions.annotations.FunctionParameters;import java.text.DecimalFormat;@FunctionCategories({ UnilimeReportFunctions.class })public class UnilimeFunctions { @Function("ROUND_MW") @FunctionParameters({ @FunctionParameter("DecimalNumber"), @FunctionParameter("DecimalPlaces")}) public static Double ROUND_MW(Double DecimalNumber, Integer DecimalPlaces) { DecimalFormat df = new DecimalFormat(); return 15.0; } @Function("HELLO_WORLD_MSG") public static String HELLO_WORLD_MSG() { return "Hello World!"; } @Function("REPEAT_MSG") @FunctionParameters({ @FunctionParameter("message"), @FunctionParameter("times"), @FunctionParameter("forceUpperCase") }) public static String REPEAT_MSG(String message, Integer times) { return REPEAT_MSG(message, times, false); } public static String REPEAT_MSG(String message, Integer times, Boolean forceUpperCase) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < times; i++) { sb.append(message).append("n"); } String txt = sb.toString(); if (forceUpperCase) { txt = txt.toUpperCase(); } return txt; }}[/code]I would really aprecciate any kind of help. Even where I have to start looking
×
×
  • Create New...