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

akovach

Members
  • Posts

    30
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Downloads

Everything posted by akovach

  1. RequirementThere may be a usecase or a need to show the last value in the group field based on some condition. This can be achieved with a variable in a group footer. SolutionLets say, we have a report which have the following SQL Query in dataset: SELECT "GrpID","WorkID","Risk","Include" FROM (VALUES ('g1','w1','30','Y'), ('g1','w2','20','Y'), ('g1','w3',null,'N'), ('g1','w4','40','N'), ('g2','w1','10','Y') )s ("GrpID","WorkID","Risk","Include") If we will add a group in report based on GrpID, there will be two groups. Now we need to show the last value of field Risk, where Include equals 'Y'. For this we need to create a variable Variable_1 with the following expression: IF($F{Include}.equals("Y"),$F{Risk},$V{Variable_1}) So after report execution we will have '20' shown in group footer for the first group and '10' for the second group. ReferencesVariables in reports ref case 01814677 - akovach
  2. RequirementWhen user creates a a TreeMap in Jaspersoft Studio, there might be a need to display several categories of data on chart: By default, TreeMap won`t show several categories, but will make a drill down from level one to level two, which can be accessed via clicking on chart series SolutionIt is possible to do this with Chart Properties in Jaspersoft Studio. For this you need to open Chart Properties > Go to Advanced Chart Properties > PlotOptions >Treemap > dataLablels > Enabled and set it to true (plotOptions.treemap.dataLabels.enabled). The result will be the following: By default the result will be following: If to click on Retailer 57 rectangle this will open next level of chart via drill down: ReferencesTreeMap JS Sample ref case - 01786140 akovach treemap_levels.jrxml
  3. RequirementSet "Include dependencies" property to false by default when exporting from repository SolutionThis requirement can be achieved by changing <js-webapp>/scripts/bower_components/jrs-ui/src/tenantImportExport/export/model/ExportModel.js: ExportModel = BaseModel.extend({ defaults: { "uris": ["/"], "fileName": "export.zip", "encryptFile": false, "includeRepositoryPermissions": true, "includeScheduledReportJobs": true, "includeDependencies": true, "includeFullResourcePath": true }[/code]So the block above should look like: ExportModel = BaseModel.extend({ defaults: { "uris": ["/"], "fileName": "export.zip", "encryptFile": false, "includeRepositoryPermissions": true, "includeScheduledReportJobs": true, "includeDependencies": false, "includeFullResourcePath": true }[/code]Then user need to rebuild JavaScript files as described in the article below: Customizing JavaScript Files in JasperReports Server Or user can set javascript.optimize=false in the <js-webapp>/WEB-INF/js.config.properties file and then reloading the web application. In this case JasperReports Server will use Scripts, instead of optimizedScripts. ResultThis change will result in the following output of Repository Export Dialog Window: ReferencesCustomizing JavaScript Files in JasperReports Server ref case - 01779385 akovach
  4. RequirementThere are some uncommon usecases, when users need to install TIBCO JasperReports® Server on Oracle Service with Oracle Advanced Security Enabled. SolutionInstall JasperReports® Server on such environment is not a common usecase, so some addtional changes should be done before installation. First, User needs to set serviceName instead of SID in default_master.properties. The result will be like: serviceName=Name After this, User need to open /buildomatic/conf_source/db/oracle/db.template.properties and append OAS properties in the end of the following lines for connection to Oracle: admin.jdbcUrl=jdbc:tibcosoftware:oracle://${dbHost}:${dbPort};${dbSidOrServiceNameProp}${AdditionalAdminProperties} js.jdbcUrl=jdbc:tibcosoftware:oracle://${dbHost}:${dbPort};${dbSidOrServiceNameProp} sugarcrm.jdbcUrl=jdbc:tibcosoftware:oracle://${dbHost}:${dbPort};CatalogOptions=0;${dbSidOrServiceNameProp} foodmart.jdbcUrl=jdbc:tibcosoftware:oracle://${dbHost}:${dbPort};CatalogOptions=0;${dbSidOrServiceNameProp} So the result will be like the following: admin.jdbcUrl=jdbc:tibcosoftware:oracle://${dbHost}:${dbPort};${dbSidOrServiceNameProp}${AdditionalAdminProperties};DataIntegrityLevel=accepted;EncryptionLevel=accepted;EncryptionType=AES256 js.jdbcUrl=jdbc:tibcosoftware:oracle://${dbHost}:${dbPort};${dbSidOrServiceNameProp};DataIntegrityLevel=accepted;EncryptionLevel=accepted;EncryptionType=AES256 sugarcrm.jdbcUrl=jdbc:tibcosoftware:oracle://${dbHost}:${dbPort};CatalogOptions=0;${dbSidOrServiceNameProp};DataIntegrityLevel=accepted;EncryptionLevel=accepted;EncryptionType=AES256 foodmart.jdbcUrl=jdbc:tibcosoftware:oracle://${dbHost}:${dbPort};CatalogOptions=0;${dbSidOrServiceNameProp};DataIntegrityLevel=accepted;EncryptionLevel=accepted;EncryptionType=AES256 After all these changes User can install JasperReports Server on Oracle Service with Oracle Advanced Security enabled. ReferencesOAS SpecificationConnect to Oracle Serviceref - akovach 01771283
  5. ProblemTIBCO JasperReports® Server v7.2.0 and greater may see the following exception: [toc]Exception in thread "License activation thread" java.lang.NoClassDefFoundError: org/apache/axis/AxisFault at com.jaspersoft.ji.license.LicenseSupport.doActivateLicense(LicenseSupport.java:213) at com.jaspersoft.ji.license.LicenseProviderImpl$1.run(LicenseProviderImpl.java:323) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassNotFoundException: org.apache.axis.AxisFault at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1308) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1136) ... 3 more This error message may appear because Axis JARs were removed in JasperReports® Server v7.2.0 and later versions. These packages were mostly used for SOAP Services and OLAP. Since SOAP was deprecated, these packages were excluded from JasperReports Server. However ExplanationThis exception is a defect in the 7.2.0 and later versions of JasperReports Server. Functionality of the JasperReports Server is not affected. The license checking process in JasperReports Server commercial editions also relies on SOAP requests to "activate" the license when the license is used for the first time on an operating system, so this non-fatal exception will appear in the logs. The defect is submitted on Jaspersoft internal JIRA (internal tracking number JS-34829) and will be addressed in future releases. The attached JARs within a zip can be deployed into WEB-INF/lib to remove the exception in the logs. Case - 01771222 akovach jasperreports-server-hotfix-js-34829.zip jasperreports-server-missing-soap-jars-js-34829.zip
  6. Hi David, Indeed, the thing may be in evaluation time of Text Field, where variable is used. You can set evaluation time to Auto, it might help to achieve the requirement of yours Regards
  7. RequirementEnable REST API Logging on JasperReports Server to track REST Requests and Responses. SolutionProduct uses Jersey Framework for exposing REST services. There are few types of logging information supported by Jersey: Request/Response logging - supports the logging request and response via internal client and server filters Tracing - provides tracing or diagnostic information about server-side processing of individual requests Jersey Logging Config JRS has its own config wrapper for Jersey Logging standard configuration, so instead of updating web.xml developer should make changes in applicationContext-rest-services.xml bean configuration file: <bean id="restLoggingSettings" class="com.jaspersoft.jasperserver.jaxrs.logging.RestLoggingSettings"> <!-- See detailed description of fields in javadoc of following constructor org.glassfish.jersey.logging.LoggingFeature.LoggingFeature(java.util.logging.Logger, java.util.logging.Level, org.glassfish.jersey.logging.LoggingFeature.Verbosity, java.lang.Integer)--> <property name="loggerName" value="com.jaspersoft.jasperserver.jaxrs.RestSpringApplication"/> <!-- change value below to INFO to enable REST requests/responses logging --> <property name="level" value="ALL"/> <!--Supported values for verbosity are: HEADERS_ONLY, PAYLOAD_TEXT, PAYLOAD_ANY. See more information in javadoc of org.glassfish.jersey.logging.LoggingFeature.Verbosity--> <property name="verbosity" value="PAYLOAD_ANY"/> <property name="maxEntitySize" value="1024"/></bean>[/code]!!! you need to set level property to INFO. According to Jersey Documentation simply add appropriate servlet init parameters into web.xml > Servlet JerseyREST: <init-param> <param-name>jersey.config.server.tracing.type</param-name> <param-value>ALL</param-value></init-param>[/code]ReferencesRequest/Response logging - supports the logging request and response via internal client and server filters Tracing - provides tracing or diagnostic information about server-side processing of individual requests
  8. RequirementThere might be a situation, when end user needs report export on report execution in JasperReports Server. It is possible to achieve with Rest API and a Scriptlet in a report. SolutionStep 1Lets create a Scriptlet which will make export of the report. For this we need to create a java file with the next code: [toc]package com.scriptlet.export; import net.sf.jasperreports.engine.JRDefaultScriptlet; import net.sf.jasperreports.engine.JRScriptletException; import java.net.HttpURLConnection; import java.net.URL; public class Scriptlet extends JRDefaultScriptlet { public void afterReportInit() throws JRScriptletException { try { URL obj = new URL("http://HOST:PORT/jasperserver-pro/rest_v2/reports/path/to/report/report.pdf?j_username=UserName&j_password=UserPassword"); HttpURLConnection connection = (HttpURLConnection) obj.openConnection(); connection.setRequestProperty("Accept", "application/json"); connection.setRequestMethod("GET"); connection.setDoOutput(true); connection.disconnect(); } catch (Exception e) { e.printStackTrace(); } } } Step 2Then we need to compile this file and create a jar library with its class. You can use Eclipse or Intellij Idea for this. Step 3After this we should add this library to classpath of the project in Jaspersoft Studio: Right Click on "My Reports" Project > Build Path > Configure Build Path > Libraries > Add External Libraries >(your jar file) Step 4After this we can create a report and create a scriptlet there. For this go to "Scriptlets" section from "Outline" window > Right Click on "Scriplets" and then click on "Create Scriptlet" > Give Name="Scriptlet" and Class="com.scriptlet.export.Scriptlet" (with out double quotes) > Observe that as quick as you create Scriptlet, Jasper Studio engine creates a parameter in "Parameters" node. Here it will create "Scriptlet_SCRIPTLET" Now, create a TextField with the following expression: $P{Scriptlet_SCRIPTLET}.afterReportInit() Step 5Publish report to the server and run it. You should get pdf export along with report output in JasperReports Server UI. ReferencesReports Services of REST API Scriptlet Tutorial Simple Scriptlet Example ref case - akovach 01673546 scriptlet.jar
  9. Hi you can do this with stacked column chart of HTML5 Charts component. Check the report in attachment
  10. Hi, If your field is java.lang.String type use $F{field}.substring(startIndex, endIndex) Otherwise, use $F{field}.toString().substring(startIndex, endIndex) In usecase from question it will be: $F{field}.substring(18, 21)
  11. Hi, It is not receommended to use '==' with String values. Use $F{RFS_GRADE_CODE}.equals("EE") instead. This is because the == operator only compares object references, while the String.equals() method compares both String's values i.e. the sequence of characters that make up each String
  12. RequirementSome JasperReports Server Administrators might want to check or monitor Repository structure of JasperReports Server or embedding it in custom application. Rest API can help to achieve this requirement. SolutionUser can retrieve a structure of JasperReports Repository with Resources Service. The Request will contain several parameters: type=folder limit=1000 expanded=true Also authentication credentials might be needed, if Authentication was not passed before. The final Request will look like: GET http://host:port/jasperserver-pro/rest_v2/resources?expanded=true&limit=1000&type=folder&j_username=userLogin&j_password=userPassword If Organization repository structure is needed, you can use %7Corganization_id parameter as in Login request GET http://host:port/jasperserver-pro/rest_v2/resources?expanded=true&limit=1000&type=folder&j_username=userLogin%7Corganization_id &j_password=userPasswordUser will get all folders in XML/JSON format. ReferencesREST API Login Service REST API Resources Service ref case - btimakov 01400354
  13. RequirementSome JasperReports Server Administrators might want to check or monitor Repository structure of JasperReports Server or embedding it in custom application. Rest API can help to achieve this requirement. SolutionUser can retrieve a structure of JasperReports Repository with Resources Service. The Request will contain several parameters: type=folder limit=1000 expanded=true Also authentication credentials might be needed, if Authentication was not passed before. The final Request will look like: GET http://host:port/jasperserver-pro/rest_v2/resources?expanded=true&limit=1000&type=folder&j_username=userLogin&j_password=userPassword If Organization repository structure is needed, you can use %7Corganization_id parameter as in Login request GET http://host:port/jasperserver-pro/rest_v2/resources?expanded=true&limit=1000&type=folder&j_username=userLogin%7Corganization_id &j_password=userPasswordUser will get all folders in XML/JSON format. ReferencesREST API Login Service REST API Resources Service ref case - btimakov 01400354
  14. Hello, You can turn off pagination with Ignore Pagination proeprty of report. It will generate one page report and all rows will be displayed on one page Regards, Alex
  15. RequirementThere might be a situation when JasperReports Administrators need to monitor JasperReports Server status on its inactivity - if it is up and running. SolutionIt is possible to maintain simple monitoring script using ServerInfo Service of JasperReport Server REST API. The following example is using JavaScript function which sends Rest Call to read response status. The ServerInfo Service allows to reach JasperReports Server without autentication and will always succeed when the server is running. The Rest Call looks like: http://<host>:<port>/jasperserver[-pro]/rest_v2/serverInfo You can perform a request from JavaScript function and read the status of the response: function checkStatus() { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { console.log("Its Alive!"); } else { console.log("Check if Server OK") } }; xhttp.open("GET", "http//host:port/jasperserver-pro/rest_v2/serverInfo", true); xhttp.setRequestHeader("Accept", "application/json"); xhttp.send(); } This function sends request to server, checks if response is ready and returns the status status. You can set a timer to automatically execute this script every minute or other with the following expression: setInterval(checkStauts, 60*1000) ReferencesJasperReports Server ServerInfo Service
  16. Hello, the Axis values are set according to data in category and measures. However, you can set a point start on Axis with plotOptions.series.pointStart property in chart: https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-pointstart-linear/
  17. RequirementSometimes JasperReports Server Administrators need to upload and manage UI themes. It is possible to upload UI theme using REST API. SolutionTo upload a theme with REST Call, you can use import service: http://<host>:<port>/jasperserver-pro/rest_v2/import?<arguments> Set skipThemes? flag to false in Call Descriptor and UI theme will be uploaded to JasperReports Server repository ReferencesREST API Import Service ref case - spolivyanenko 01649198
  18. RequirementSometimes there is requirement to generate a pdf or another format of another report via hyperlink from main report. User expects to get output of another report without running it in UI. SolutionUsers can manage hyperlink on TextField Element in report in Jaspersoft Studio. There is possibility to use REST API features in such hyperlinks. To achieve this you would need to create a hyperlink on TextField with the following properties: Link Target - Blank Link Type - Reference Hyperlink Reference Expression - value like: "http://HOST:PORT/jasperserver-pro/rest_v2/reports/public/Samples/Reports/AllAccounts.pdf" This will generate a pdf export of AllAcounts report from Main Report in JasperReports Server. If you need to get pdf export of report from another server, not local one, the expression should look like: "http://HOST:PORT/jasperserver-pro/rest_v2/reports/public/Samples/Reports/AllAccounts.pdf?j_username=userLogin&j_password=userPassword" ReferencesGet Report Export Via REST API Hyperlink Examples Jaspersoft Studio User Guide - Hyperlinks ref case - asymkin 01671629
  19. Hi, The following might help you: CONCATENATE (new BigDecimal($F{F1}).setScale(3, BigDecimal.ROUND_CEILING), "/", new BigDecimal($F{F2}).setScale(3, BigDecimal.ROUND_CEILING)) Here is the link to Rounding of BigDecimal: https://community.jaspersoft.com/wiki/how-round-bigdecimal-value
  20. RequirementSometimes user needs to have Date fields represented with another Timezone. It is possible to achieve with out-of-box tools of JasperReports Server. SolutionTo change Timezone of a field we would need to append several configuration files with our customization. In BaseGroovyColumn.groovy add a new function which will convert our field with Date type to another timezone. def convertDateToTimestamp(Date dateField, String timezone) { if (dateField != null && dateField != null) { def date = dateField def timeZone = TimeZone.getTimeZone(timezone) def dateT = dateField.format('dd.MM.yyy HH:mm:ss', timeZone) def convert = new SimpleDateFormat('dd.MM.yyy HH:mm:ss').parse(dateT) return new Timestamp (convert.getTime()) } return null } In ApplicationContext-el-operators.xml file add a definition for our new function. This step is required to make sure function processes values with correct types and available in list of functions in Ad Hoc View of calculated fields. <bean parent="functionDef"> <property name="name" value="convertDateToTimestamp"/> <property name="javaType" value="java.sql.Timestamp"/> <property name="argumentTypes"> <list> <value>#{objectTypeMapper.checkType('Any')}</value> <value>#{objectTypeMapper.checkType('Any')}</value> </list> </property> <property name="properties"> <map> <entry key="inAvailableFunctions" value="true"/> <entry key="alwaysInSQL" value="false"/> </map> </property> <property name="inMemory" value="true"/> </bean> In adhoc_messages.properties add a description property for the function: adh.calculated.fields.function.description.convertDateToTimestamp=Convert a timezone of Date field ResultsIn Ad Hoc View create a calculated field, which will contain function with two arguments: Date field to be converted and timezone which will be set in new field. There will be a new Date field with another timezone in result. Useful referencesSetting behavior for functions Creating custom function for Ad Hoc Views ref case akovach 01572297
  21. RequirementSometimes user needs to have Date fields represented with another Timezone. It possible to achieve with out-of-box tools of JasperReports Server. SolutionTo change Timezone of a field we woild need to append several configuration files with our customization. In BaseGroovyColumn.groovy we will add a new function which will convert our field with Date type to another timezone. def convertDateToTimestamp(Date dateField, String timezone) { // timestamp - your date field, timezone - your desired timezone if (dateField != null && dateField != null) { def date = dateField def timeZone = TimeZone.getTimeZone(timezone) //generate a timezone def dateT = dateField.format('dd.MM.yyy HH:mm:ss', timeZone) def convert = new SimpleDateFormat('dd.MM.yyy HH:mm:ss').parse(dateT) return new Timestamp (convert.getTime()) } return null } In ApplicationContext-el-operators.xml file we need to add a definition for our new function. This step is required to make sure function processes values with correct types and available in list of functions in Ad Hoc View of calculated fields. <bean parent="functionDef"> <property name="name" value="convertDateToTimestamp"/> <property name="javaType" value="java.sql.Timestamp"/> <!-- type of field returned --> <property name="argumentTypes"> <list> <value>#{objectTypeMapper.checkType('Any')}</value> <!-- type of first argument --> <value>#{objectTypeMapper.checkType('String')}</value> <!-- type of second argument --> </list> </property> <property name="properties"> <map> <!-- show in calc field dialog --> <entry key="inAvailableFunctions" value="true"/> <!-- do not use in SQL Executor --> <entry key="alwaysInSQL" value="false"/> </map> </property> <!-- use always in Ad Hoc JRS memory for calculation --> <property name="inMemory" value="true"/> </bean> Add a description property for the function in adhoc_messages.properties: adh.calculated.fields.function.description.convertDateToTimestamp=Convert a timezone of Date field Useful referencesSetting behavior for functions Creating custom function for Ad Hoc Views ref case akovach 01572297
  22. Hi Gadbriel, You need to create a scriptlet which decodes your parameter in report and use method of scriptlet which decodes in your expression: https://www.tutorialspoint.com/jasper_reports/jasper_report_scriptlets.htm https://community.jaspersoft.com/blog/all-you-want-know-about-scriptlets https://community.jaspersoft.com/blog/scriptlet-example-jaspersoft-6x-begineers-hello-world-sample-example https://examples.javacodegeeks.com/core-java/apache/commons/codec/decode-base64/ https://stackoverflow.com/questions/469695/decode-base64-data-in-java Regards,
  23. Hi James, you can get time part from date object with new SimpleDateFormat("HH:mm:ss").format("$F{date_field}"). Then compare it with your parameter. If true, in new variable or field add one day to field with: new DateUtils.AddDays("$F{date_field}", 1) Regards,
  24. Hi, You can use variable report_count for this in your print when expression: https://www.tutorialspoint.com/jasper_reports/jasper_report_variables.htm Regards,
  25. Hello, The following topic might help you to achieve this. You just need to change expression from article to parse your locale and currency symbol https://community.jaspersoft.com/wiki/how-maintain-dynamic-currency-symbol-different-organizations
×
×
  • Create New...