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

srhaque

Members
  • Posts

    29
  • Joined

  • Last visited

srhaque's Achievements

Explorer

Explorer (4/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Collaborator Rare

Recent Badges

0

Reputation

  1. I'm trying this again with 6.9.0, but still having problems. The source code and error is now:net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file: 1 error(s): 1. syntax error at column 124 in line StreamSupport.stream(Spliterators.spliteratorUnknownSize(field_pay_graph_results.getValue().elements(), 0), false).map(x -> x.toString()).allMatch(x -> x.equals("0.0")) . at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:206) at net.sf.jasperreports.eclipse.builder.JasperReportCompiler.compileReport(JasperReportCompiler.java:288) at com.jaspersoft.studio.editor.preview.view.control.ReportController.compileJasperDesign(ReportController.java:481) at com.jaspersoft.studio.editor.preview.view.control.ReportController.access$8(ReportController.java:466) at com.jaspersoft.studio.editor.preview.view.control.ReportController$1.run(ReportController.java:384) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) The column number points right to the "->" in the expanded source. I have edited the .ini file, so my command looks like this:/opt/tibco/TIB_js-studiocomm_6.9.0//features/jre.linux.gtk.x86_64.feature_1.8.0.u151/jre/bin/java -Xms128m -Xmx1024m -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Dorg.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -Dorg.eclipse.jdt.core.compiler.compliance=1.8 -Dorg.eclipse.jdt.core.compiler.source=1.8 -jar /opt/tibco/TIB_js-studiocomm_6.9.0//plugins/org.eclipse.equinox.launcher_1.5.300.v20190213-1655.jar -os linux -ws gtk -arch x86_64 -showsplash -launcher /opt/tibco/TIB_js-studiocomm_6.9.0/Jaspersoft Studio -name Jaspersoft Studio --launcher.library /opt/tibco/TIB_js-studiocomm_6.9.0//plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.1000.v20190125-2016/eclipse_1801.so -startup /opt/tibco/TIB_js-studiocomm_6.9.0//plugins/org.eclipse.equinox.launcher_1.5.300.v20190213-1655.jar --launcher.overrideVmargs -exitdata d78003 -data @noDefault -vm /opt/tibco/TIB_js-studiocomm_6.9.0//features/jre.linux.gtk.x86_64.feature_1.8.0.u151/jre/bin/java -vmargs -Xms128m -Xmx1024m -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Dorg.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -Dorg.eclipse.jdt.core.compiler.compliance=1.8 -Dorg.eclipse.jdt.core.compiler.source=1.8 -jar /opt/tibco/TIB_js-studiocomm_6.9.0//plugins/org.eclipse.equinox.launcher_1.5.300.v20190213-1655.jar I see the compiler version is/opt/tibco/TIB_js-studiocomm_6.9.0/dropins/eclipse/plugins/org.eclipse.jdt.core.compiler.batch.nl_it_4.2.0.v20130724060447.jar I don't see an ecj.jar in the distribution, but can download one from Maven. But I've no idea what to do with it to have it take effect. Help much appreciated, Thanks.
  2. FWIW, I've been using OpenJDK11 for a while, and as per your note, it seems to work just fine.
  3. I have some <subDataset>s with <dataSourceExpression>s containing moderately complex Javascript, e.g.: ..<dataSourceExpression><![CDATA[(function () {// TODO: See https://community.jaspersoft.com/questions/1112616/nested-table-data-source-woes-jsoninputstream-and-reportdatasource-seem-brokenfunction get_definitions(algorithm) { // Find the right PayOp. var ops = JSON.parse($F{top}.get("payop")); var opId = null; ...}etcetcetc}).apply()]]></dataSourceExpression>..[/code]I'd like to be able to reuse the get_definitions() function in other <dataSourceExpression>s. Is there a place where I can put the function one copy of the code is enough? Going further, is it possible to share: functions between (say) dataSourceExpressions and textFieldExpressions?vars between any of the above?I guess another way to state the question is "What are the scope rules for Javascript?". Thanks, Shaheed
  4. The report environment is obviously not the right place to perform complex logic, but when needs must the lack of lambda support in the available JS and troubles getting java 8+ working make a solution desirable. This technique worked for me, and I thought it might be of interest: <textFieldExpression><![CDATA[ (function () { var a = new Object($F{top}.get("buss")); var b = ...; for (var p in a) { b.push(a[p]); } return ...; } ).apply()]]></textFieldExpression>[/code]Notice the use of a "for" loop and temporary "var"s! This works because the "()" around the "function () {}" turns the declaration into an expression, which ".apply()" can run. Enjoy responsibly...
  5. JRXML <?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.6.0.final using JasperReports Library version 6.6.0 --><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="multipayslip" language="javascript" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="975714cc-487b-4780-af93-96ba4c6852ec"> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="JSON QL data"/> <style name="Table_TH" mode="Opaque" forecolor="#FFFFFF" backcolor="#08243C" fontSize="14"> <box padding="4"> <pen lineWidth="0.0" lineColor="#000000"/> </box> </style> <style name="Table_CH" mode="Opaque" forecolor="#FFFFFF" backcolor="#3A799A" fontSize="12"> <box padding="4"> <pen lineWidth="0.5" lineColor="#FFFFFF"/> </box> </style> <style name="Table_TD" mode="Opaque" forecolor="#000000" backcolor="#A8ABA5" fontSize="12"> <box padding="4"> <pen lineWidth="0.5" lineColor="#FFFFFF"/> </box> </style> <subDataset name="Busses" uuid="2817bd63-7c51-483d-bb88-e6b37adc973b"> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="JSON QL data"/> <parameter name="employee_key" class="java.lang.String"/> <queryString language="jsonql"> <![CDATA[buss.*]]> </queryString> <field name="name" class="java.lang.String"> <property name="net.sf.jasperreports.jsonql.field.expression" value="name"/> <fieldDescription><![CDATA[name]]></fieldDescription> </field> <field name="description" class="java.lang.String"> <property name="net.sf.jasperreports.jsonql.field.expression" value="description"/> <fieldDescription><![CDATA[description]]></fieldDescription> </field> </subDataset> <subDataset name="Employees" uuid="ba80e38d-858c-49c5-a296-c779f28992f2"> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="JSON QL data"/> <parameter name="employee_id" class="java.lang.String"> <parameterDescription><![CDATA[Employee database id to generate report for; empty means all employees]]></parameterDescription> </parameter> <queryString language="jsonql"> <![CDATA[employee.*]]> </queryString> <field name="id" class="java.lang.String"> <property name="net.sf.jasperreports.jsonql.field.expression" value="id"/> </field> <field name="name" class="java.lang.String"> <property name="net.sf.jasperreports.jsonql.field.expression" value="name"/> </field> <field name="email" class="java.lang.String"> <property name="net.sf.jasperreports.jsonql.field.expression" value="email"/> </field> <field name="title" class="java.lang.Integer"> <property name="net.sf.jasperreports.jsonql.field.expression" value="title"/> </field> <field name="start_date" class="java.lang.String"> <property name="net.sf.jasperreports.jsonql.field.expression" value="start_date"/> </field> <field name="end_date" class="java.lang.String"> <property name="net.sf.jasperreports.jsonql.field.expression" value="end_date"/> </field> <field name="test_employee" class="java.lang.Boolean"> <property name="net.sf.jasperreports.jsonql.field.expression" value="test_employee"/> </field> <field name="pay_graph_results" class="java.lang.Object"> <property name="net.sf.jasperreports.json.field.expression" value="pay_graph_results"/> </field> <field name="ee_tax_basis" class="java.lang.String"> <property name="net.sf.jasperreports.json.field.expression" value="ee_tax_basis"/> </field> <field name="ee_tax_reference" class="java.lang.String"> <property name="net.sf.jasperreports.json.field.expression" value="ee_tax_reference"/> </field> <field name="ee_bank_account" class="java.lang.String"> <property name="net.sf.jasperreports.json.field.expression" value="ee_bank_account"/> </field> <field name="top" class="java.lang.Object"> <propertyExpression name="net.sf.jasperreports.jsonql.field.expression"><![CDATA["$"]]></propertyExpression> <fieldDescription><![CDATA[Top level object]]></fieldDescription> </field> <filterExpression><![CDATA[/* The filter is not set, or your id matches the filter. */ ([null, "", $F{id}].indexOf($P{employee_id}) > -1) && /* You started before the end of the pay period. */ ($F{start_date} <= $F{top}.get("pay_run").get("pay_period_last_day").asText()) && /* You have not planned to leave, or are leaving after the start of the pay period. */ (($F{end_date} === null) || ($F{end_date} >= $F{top}.get("pay_run").get("pay_period_first_day").asText())) && /* You are not a test employee. */ !$F{test_employee}]]></filterExpression> </subDataset> <parameter name="employee_id" class="java.lang.String" isForPrompting="false"> <parameterDescription><![CDATA[Employee database id to generate report for; empty means all employees]]></parameterDescription> </parameter> <queryString language="jsonql"> <![CDATA[]]> </queryString> <field name="top" class="java.lang.Object"> <propertyExpression name="net.sf.jasperreports.jsonql.field.expression"><![CDATA["$"]]></propertyExpression> <fieldDescription><![CDATA[Top level object]]></fieldDescription> </field> <background> <band splitType="Stretch"/> </background> <title> <band height="79" splitType="Stretch"> <textField> <reportElement style="Table_TH" x="0" y="9" width="510" height="25" uuid="8c7b9edf-1377-4d38-b221-47a9f52c34a3"/> <textFieldExpression><![CDATA[$F{top}.get("company").get("legal_name").asText() + ", " + $F{top}.get("pay_run").get("actual_t").asText()]]></textFieldExpression> </textField> </band> </title> <detail> <band height="420" splitType="Stretch"> <componentElement> <reportElement x="0" y="20" width="520" height="400" uuid="5e3b943e-010c-4754-835d-d01807e66701"> <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/> <property name="com.jaspersoft.studio.table.style.table_header" value="Table_TH"/> <property name="com.jaspersoft.studio.table.style.column_header" value="Table_CH"/> <property name="com.jaspersoft.studio.table.style.detail" value="Table_TD"/> </reportElement> <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd"> <datasetRun subDataset="Employees" uuid="c0ea6019-8850-42da-abf4-3773fce40409"> <dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}.subDataSource("employee.*")]]></dataSourceExpression> </datasetRun> <jr:column width="510" uuid="e4eda8c4-742e-4f0e-8771-072d081e8e2e"> <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column1"/> <jr:tableHeader style="Table_TH" height="40" rowSpan="1"> <textField> <reportElement style="Table_TH" x="0" y="0" width="502" height="32" uuid="d5e0888d-0a79-4da0-8ec6-252d674b81b9"/> <textFieldExpression><![CDATA[(function () { var a = new Object($F{top}.get("buss")); var b = []; for (var p in a) { b.push(a[p]); } return new net.sf.jasperreports.engine.data.JRMapArrayDataSource(b); }).apply()]]></textFieldExpression> </textField> </jr:tableHeader> <jr:columnHeader height="186" rowSpan="1"> <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.grid.JSSGridBagLayout"/> <box topPadding="0" leftPadding="0" bottomPadding="0" rightPadding="0"/> <textField> <reportElement style="Table_TH" x="0" y="0" width="510" height="30" uuid="3bcfb36e-a0f3-4dea-b65c-ac27c0cd2078"> <property name="com.jaspersoft.layout.grid.x" value="0"/> <property name="com.jaspersoft.layout.grid.y" value="0"/> <property name="com.jaspersoft.layout.grid.weight.x" value="1.0"/> <property name="com.jaspersoft.layout.grid.weight.y" value="1.0"/> <property name="com.jaspersoft.layout.grid.rowspan" value="1"/> <property name="com.jaspersoft.layout.grid.colspan" value="2"/> <property name="com.jaspersoft.layout.grid.weight.fixed" value="true"/> </reportElement> <textFieldExpression><![CDATA[$F{top}.get("title").get("" + $F{title}).get("title").asText() + " " + $F{name} + " (" + $F{email} + ")"]]></textFieldExpression> </textField> <frame> <reportElement x="0" y="30" width="300" height="156" uuid="e3863d13-f57c-4e26-be43-c356442e665c"> <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/> <property name="com.jaspersoft.layout.grid.x" value="0"/> <property name="com.jaspersoft.layout.grid.y" value="1"/> <property name="com.jaspersoft.layout.grid.weight.x" value="1.0"/> <property name="com.jaspersoft.layout.grid.weight.y" value="1.0"/> <property name="com.jaspersoft.layout.grid.rowspan" value="6"/> <property name="com.jaspersoft.layout.grid.colspan" value="1"/> <property name="com.jaspersoft.layout.grid.weight.fixed" value="true"/> </reportElement> <staticText> <reportElement style="Table_CH" x="0" y="0" width="300" height="26" uuid="44d8982c-5fbd-4a56-a1db-21eb2c4294da"/> <text><![CDATA[Gross pay]]></text> </staticText> <staticText> <reportElement style="Table_CH" x="0" y="26" width="300" height="26" uuid="de135741-9a2b-4a18-9b87-b0a81f01ebe4"/> <text><![CDATA[Deductions]]></text> </staticText> <staticText> <reportElement style="Table_CH" x="0" y="52" width="300" height="26" uuid="2f488537-3ca8-4483-ba19-5b88b06d03cd"/> <text><![CDATA[Net pay]]></text> </staticText> <staticText> <reportElement style="Table_CH" x="0" y="78" width="300" height="26" uuid="e4a4df17-71fd-431b-9459-785a9b2e9777"/> <text><![CDATA[Tax reference]]></text> </staticText> <staticText> <reportElement style="Table_CH" x="0" y="104" width="300" height="26" uuid="bf27d631-7ff1-40aa-9ae9-350ea1823ed5"/> <text><![CDATA[Tax basis]]></text> </staticText> <staticText> <reportElement style="Table_CH" x="0" y="130" width="300" height="26" uuid="de7f5bd1-df08-4b28-a13c-1ba604133ff1"/> <text><![CDATA[bank Account]]></text> </staticText> </frame> <frame> <reportElement x="300" y="30" width="210" height="156" uuid="1628fbd8-cc7b-4213-b45e-c9bef24dce5e"> <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/> <property name="com.jaspersoft.layout.grid.x" value="1"/> <property name="com.jaspersoft.layout.grid.y" value="1"/> <property name="com.jaspersoft.layout.grid.weight.x" value="1.0"/> <property name="com.jaspersoft.layout.grid.weight.y" value="1.0"/> <property name="com.jaspersoft.layout.grid.rowspan" value="6"/> <property name="com.jaspersoft.layout.grid.colspan" value="1"/> <property name="com.jaspersoft.layout.grid.weight.fixed" value="true"/> </reportElement> <textField> <reportElement style="Table_TD" x="0" y="0" width="210" height="26" uuid="e0dda6f4-d5b9-4934-9f59-6250999ce20e"/> <textFieldExpression><![CDATA[parseFloat($F{pay_graph_results}.get("gross_pay")).toFixed(2)]]></textFieldExpression> </textField> <textField> <reportElement style="Table_TD" x="0" y="26" width="210" height="26" uuid="3247e522-006c-400f-8ff4-98a9b6ed75ea"/> <textFieldExpression><![CDATA[($F{pay_graph_results}.get("gross_pay") - $F{pay_graph_results}.get("net_pay")).toFixed(2)]]></textFieldExpression> </textField> <textField> <reportElement style="Table_TD" x="0" y="52" width="210" height="26" uuid="51e5b667-68ee-47fd-8c4a-260ec22107df"/> <textFieldExpression><![CDATA[parseFloat($F{pay_graph_results}.get("net_pay")).toFixed(2)]]></textFieldExpression> </textField> <textField> <reportElement style="Table_TD" x="0" y="78" width="210" height="26" uuid="04f7103e-c02c-42c0-bcd1-3ab95a14b800"/> <textFieldExpression><![CDATA[$F{ee_tax_basis}]]></textFieldExpression> </textField> <textField> <reportElement style="Table_TD" x="0" y="104" width="210" height="26" uuid="569a62af-4210-479a-8f9c-1b8f94806226"/> <textFieldExpression><![CDATA[(function () {var a=""+$F{ee_tax_reference}; return a.substr(0, a.length-3).replace(/w/gi, "*") + a.substr(a.length - 3);}).apply()]]></textFieldExpression> </textField> <textField> <reportElement style="Table_TD" x="0" y="130" width="210" height="26" uuid="66a4611f-219a-4c07-9521-7eaa1e9e7e3e"/> <textFieldExpression><![CDATA[(function () {var a=""+$F{ee_bank_account}; return a.substr(0, a.length-3).replace(/w/gi, "*") + a.substr(a.length - 3);}).apply()]]></textFieldExpression> </textField> </frame> </jr:columnHeader> <jr:detailCell height="137"> <box topPadding="20"/> <componentElement> <reportElement x="0" y="0" width="510" height="117" uuid="d38e0fea-3e6d-4eed-bf6d-b13997fb05a1"> <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/> <property name="com.jaspersoft.studio.table.style.table_header" value="Table_TH"/> <property name="com.jaspersoft.studio.table.style.column_header" value="Table_CH"/> <property name="com.jaspersoft.studio.table.style.detail" value="Table_TD"/> </reportElement> <jr:table> <datasetRun subDataset="Busses" uuid="54507be6-3136-4590-9ec4-a33ce73911e5"> <datasetParameter name="employee_key"> <datasetParameterExpression><![CDATA[$F{id}]]></datasetParameterExpression> </datasetParameter> <dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}.subDataSource("employee_id")]]></dataSourceExpression> </datasetRun> <jr:column width="100" uuid="299a669e-1c4d-4767-85ec-fd7b1cd2f75e"> <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column1"/> <jr:columnHeader height="40" rowSpan="1"> <staticText> <reportElement style="Table_CH" x="0" y="0" width="100" height="40" uuid="fbcbda95-9897-455e-88eb-6419f0d356de"/> <text><![CDATA[name]]></text> </staticText> </jr:columnHeader> <jr:detailCell height="40"> <textField> <reportElement style="Table_TD" x="0" y="0" width="100" height="40" uuid="2d9a305c-1da2-4cae-8b7d-0e23e905464f"/> <textFieldExpression><![CDATA[$F{name}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="200" uuid="de42aaac-a2fe-4481-a710-89bc00c8f419"> <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2"/> <jr:columnHeader height="40" rowSpan="1"> <staticText> <reportElement style="Table_CH" x="0" y="0" width="200" height="40" uuid="8d3966a4-4032-440e-b608-209247fe7aa0"/> <text><![CDATA[description]]></text> </staticText> </jr:columnHeader> <jr:detailCell height="40"> <textField> <reportElement style="Table_TD" x="0" y="0" width="200" height="40" uuid="e0228ace-c766-4ace-8feb-664e04b67924"/> <textFieldExpression><![CDATA[$F{description}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="110" uuid="bc371f28-90bc-452e-9ce7-7ae30e4f905b"> <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column3"/> <jr:columnHeader height="40" rowSpan="1"> <staticText> <reportElement style="Table_CH" x="0" y="0" width="110" height="40" uuid="8c203d8b-25e7-4e73-9890-6bfe941c099c"/> <text><![CDATA[periodValue]]></text> </staticText> </jr:columnHeader> <jr:detailCell height="40"> <textField> <reportElement style="Table_TD" x="0" y="0" width="110" height="40" uuid="6605a07f-e2c1-4264-9d75-5b92cda707e1"/> <textFieldExpression><![CDATA["z"]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="100" uuid="a02cfe69-4b53-4ebb-94a7-70cf5e1166f9"> <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column4"/> <jr:columnHeader height="40" rowSpan="1"> <staticText> <reportElement style="Table_CH" x="0" y="0" width="100" height="40" uuid="72715923-8cc3-46ca-8a53-f02d3f22600f"/> <text><![CDATA[yearToDateValue]]></text> </staticText> </jr:columnHeader> <jr:detailCell height="40"> <textField> <reportElement style="Table_TD" x="0" y="0" width="100" height="40" uuid="d9c971ce-1ad1-4935-9873-2d969b4e1c8b"/> <textFieldExpression><![CDATA["s"]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> </jr:table> </componentElement> </jr:detailCell> </jr:column> </jr:table> </componentElement> </band> </detail></jasperReport>[/code]and sample JSON: { "buss": { "10001": { "id": 10001, "name": "company0", "description": "Custom use 0", "jurisdiction": "Company" }, "10002": { "id": 10002, "name": "company1", "description": "Custom use 1", "jurisdiction": "Company" }, "10003": { "id": 10003, "name": "company2", "description": "Custom use 2", "jurisdiction": "Company" }, "10004": { "id": 10004, "name": "company3", "description": "Custom use 3", "jurisdiction": "Company" }, "10005": { "id": 10005, "name": "company4", "description": "Custom use 4", "jurisdiction": "Company" }, "10006": { "id": 10006, "name": "company5", "description": "Custom use 5", "jurisdiction": "Company" }, "10007": { "id": 10007, "name": "company6", "description": "Custom use 6", "jurisdiction": "Company" }, "10008": { "id": 10008, "name": "company7", "description": "Custom use 7", "jurisdiction": "Company" }, "10009": { "id": 10009, "name": "company8", "description": "Custom use 8", "jurisdiction": "Company" }, "10010": { "id": 10010, "name": "company9", "description": "Custom use 9", "jurisdiction": "Company" }, "10011": { "id": 10011, "name": "bonus_eligible_pay", "description": "Bonus-eligible pay", "jurisdiction": "Universal" }, "10012": { "id": 10012, "name": "holidays_accrued", "description": "Holidays accrued", "jurisdiction": "Universal" }, "10013": { "id": 10013, "name": "holidays_taken", "description": "Holidays taken", "jurisdiction": "Universal" }, "10014": { "id": 10014, "name": "net_pay", "description": ".Net pay", "jurisdiction": "Universal" }, "10015": { "id": 10015, "name": "PE", "description": "Pension-eligible pay", "jurisdiction": "Universal" }, "10016": { "id": 10016, "name": "pension", "description": "Pension saving", "jurisdiction": "Universal" }, "10017": { "id": 10017, "name": "gross_pay", "description": ".Gross pay", "jurisdiction": "Universal" }, "10018": { "id": 10018, "name": "sick_days_taken", "description": "Sick days taken", "jurisdiction": "Universal" }, "10019": { "id": 10019, "name": "PBIK", "description": "Payroll benefits in kind", "jurisdiction": "Universal" }, "20001": { "id": 20001, "name": "paye_gp", "description": "Gross pay for PAYE purposes", "jurisdiction": "GB" }, "20002": { "id": 20002, "name": "nic_gp", "description": "Gross pay for NIC purposes", "jurisdiction": "GB" }, "20003": { "id": 20003, "name": "QE", "description": "Qualifying earnings", "jurisdiction": "GB" }, "20004": { "id": 20004, "name": "income_tax", "description": "PAYE.Tax paid", "jurisdiction": "GB" }, "20005": { "id": 20005, "name": "nic_ee", "description": "NIC.Employee", "jurisdiction": "GB" }, "20006": { "id": 20006, "name": "nic_er", "description": "NIC.Employer", "jurisdiction": "GB" }, "20007": { "id": 20007, "name": "sl_recovered", "description": "Student Loan recovered", "jurisdiction": "GB" }, "20008": { "id": 20008, "name": "ae_pension", "description": "AE Pension", "jurisdiction": "GB" } }, "title": { "1": { "id": 1, "title": "Mr.", "is_suffix": false }, "2": { "id": 2, "title": "Ms.", "is_suffix": false }, "3": { "id": 3, "title": "Mrs.", "is_suffix": false }, "4": { "id": 4, "title": "Miss.", "is_suffix": false } }, "client": { "id": 62, "legal_name": "HMRC" }, "company": { "id": 112, "client": 62, "legal_name": "HMRC RTI Recognition", "jurisdiction": "GB" }, "pay_run": { "id": 1562, "manual": true, "next_t": "2019-04-30", "company": 112, "actual_t": "2019-03-31", "schedule": 73, "target_t": "2019-03-31", "tax_week": 52, "tax_year": 2018, "frequency": "m1", "tax_month": 12, "scale_factor": 0.08333333333333333, "pay_period_last_day": "2019-04-05", "pay_period_first_day": "2019-03-06" }, "success": true, "employee": { "293": { "id": 293, "name": "Jimmy Restof-Uk", "email": "Jimmy.Restof-Uk@hmrc.co.uk", "state": { "report": { "GB RTI FPS": { "Starter": "2018-01-01" } }, "actual_t": "2019-02-28", "pay_graph": { "": { "Net pay.YTD": 14974.68, "Gross pay.YTD": 20400.0 }, "NIC": { "Employee.YTD": 1437.1200000000001, "Employer.YTD": 1652.64, "Current Letter": "A", "Letters and Values": "[{"GP": "1700.00", "GP-YTD": "20400.00", "LEL-YTD": "6036.00", "LEL-PT-YTD": "2388.00", "PT-UEL-YTD": "11976.00", "Er": "137.72", "Er-YTD": "1652.64", "Ee": "119.76", "Ee-YTD": "1437.12", "Letter": "A"}]" }, "PAYE": { "W1_M1": false, "PBIK-YTD": 0.0, "Tax code": "45L", "Tax paid.YTD": 3988.2, "Gross pay, YTD": 20400.0, "Taxable pay.YTD": 20400.0, "Starting declaration": "" } } }, "title": 1, "groups": [], "mobile": "+447000123456", "company": 112, "end_date": "2019-04-05", "is_staff": false, "password": "pbkdf2_sha256$120000$KHRUWPqJ8SBk$eCCUY4MHB3pnsDAlyC514jRKuTUe4M8HE5RHoAeY5qQ=", "user_ptr": 293, "pay_graph": 2, "taxdetail": { "id": 212, "gender": "M", "employee": 293, "NI_number": "KC489444C", "NI_category": "General", "P45_tax_code": null, "student_loan": 0, "week1_month1": false, "date_of_birth": "1995-08-14", "SL_start_notice": 0, "tax_code_notice": "45L", "P45_leaving_date": null, "company_director": false, "employee_statement": null, "weekly_hours_worked": "D", "P45_total_pay_to_date": null, "P45_total_tax_to_date": null, "company_director_from": null, "employeetaxdetail_ptr": 212, "Director_NI_cumulative": false, "employeetaxeedetail_ptr": 212, "P45_continue_student_loan": 0 }, "bankdetail": { "id": 202, "employee": 293, "sort_code": "162534", "account_name": "Jimmy Restof-Uk", "account_number": "12345678", "employeebankdetail_ptr": 202 }, "department": 129, "last_login": "2018-12-08T14:22:43.048Z", "start_date": "2018-01-01", "employee_id": "TAX1", "cost_centres": [], "ee_tax_basis": "(A) 45L", "is_superuser": false, "postaldetail": { "id": 212, "line1": "1 Tax Test Road", "line2": "PAYE Town", "line3": "", "line4": "", "employee": 293, "postcode": "BN1 1YD", "employeepostaldetail_ptr": 212 }, "pay_after_end": "", "test_employee": false, "ee_bank_account": "162534 12345678", "participant_ptr": 293, "ee_tax_reference": "KC489444C", "pay_graph_inputs": { "Salary": { "id": 967, "Base Salary": 20400 } }, "user_permissions": [], "pay_graph_outputs": { "NIC": { "Employee NIC": -119.76, "Employer NIC": -137.72 }, "PAYE": { "Tax Deduction": -332.4 }, "Salary": { "Pay, base": 1700.0 } }, "pay_graph_results": { "PE": 1700.0, "QE": 1700.0, "nic_ee": -119.76, "nic_er": -137.72, "nic_gp": 1700.0, "net_pay": 1247.8400000000001, "paye_gp": 1700.0, "gross_pay": 1700.0, "income_tax": -332.4, "bonus_eligible_pay": 1700.0 } } }}[/code]
  6. I should mention that I have tested the dataset using the preview facility, and so verified that the "buss.*" is present and formed as I expect in the test JSON data.
  7. I'm trying to get nested tables working with my JSON data. My outer table works just fine, and has its data source set in the usual way like this: $P{REPORT_DATA_SOURCE}.subDataSource("employee.*")[/code]In the Detail band of this outer table, I'm trying to set up a nested table, but using the corresponding data source: $P{REPORT_DATA_SOURCE}.subDataSource("buss.*")[/code]always just gives me no records. In trying to debug this, if I set the string parameter to "employee_id" which is a field in the outer table, I do get a single result record. This seems to suggest that the inner table is getting a data source not based in the root of the JSON heirarchy, but rather at the level of the outer table. I therefore tried all sorts of alternatives to the string parameter to try to move up to the root, including "^^.buss.*" and "$.buss.*" to no avail. Interestingly, if I try to set the data source using like this: net.sf.jasperreports.engine.data.JsonQLDataSource($P{JSON_INPUT_STREAM})[/code]then I get an error to the effect that the $P{JSON_INPUT_STREAM} is null: ...Caused by: org.mozilla.javascript.EvaluatorException: The choice of Java constructor net.sf.jasperreports.engine.data.JsonQLDataSource matching JavaScript argument types (null) is ambiguous; candidate constructors are: JsonQLDataSource(java.io.File) JsonQLDataSource(java.io.InputStream) (multipayslip_Employees_1544352224903_109951#8)...[/code]The overall effect seems to be that the various system defined parameters $P{REPORT_DATA_SOURCE} and $P{JSON_INPUT_STREAM} are not being passed into the nested table as I am expecting. What am I missing? I've scoured this forum and StackOverflow to no effect, so any hints are welcome. Thanks, Shaheed
  8. I see from Google that Rhino is effectively dead. Is there a plan to get to a newer version of JS? I see that there is now "standard" support in Oracle's setup, but am not sure of the wider picture.
  9. Based on this thread I looked for what version of the org.eclipse.jdt.core.compiler I have nad it appears to be this one: /opt/tibco/TIB_js-studiocomm_6.6.0/dropins/eclipse/plugins/org.eclipse.jdt.core.compiler.batch.nl_it_4.2.0.v20130724060447.jar[/code]Is this 4.2.0.v20130724060447.jar recent enough? If not, I'd appreciate some guidance on how to swap a newer one in. I know how to spell Maven, but I'm not au fait with it beyond that.
  10. I'm using JasperStudio 6.6.0 on Linux. I'm having trouble getting lambdas to be recognised. I tried adding: -Dorg.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8-Dorg.eclipse.jdt.core.compiler.compliance=1.8-Dorg.eclipse.jdt.core.compiler.source=1.8[/code]to my .ini file, and have confirmed these option are present in the output of "ps -eaf". However, I still get errors like this: net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:1 error(s):1. syntax error (expression#3) at column 18 in line false).map(x -> x.getKey()).getClass(). at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:206) at net.sf.jasperreports.eclipse.builder.JasperReportCompiler.compileReport(JasperReportCompiler.java:286) at com.jaspersoft.studio.editor.preview.view.control.ReportController.compileJasperDesign(ReportController.java:467) at com.jaspersoft.studio.editor.preview.view.control.ReportController.access$8(ReportController.java:452) at com.jaspersoft.studio.editor.preview.view.control.ReportController$1.run(ReportController.java:376) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)[/code]Any hints would be most welcome. Thanks, Shaheed
  11. Got it, thanks. So the fundamental tradoff between the two approaches is whether the complexity of the "walk" is in the subDataSet JSONQL setup, or the textField Java/Groovy/Javascript usage. I guess for different uses cases, either might be preferred. The subDataSet feels more "declarative" in nature, and the textField is more towards the Turing complete end of the spectrum (especially if you guys upgrade the JS version :-)).
  12. Thanks for the (quick!) answers... On the "*", thanks. On the JS version, yes, I worked out that you have Rhino. I'm not totally clear on what that means, and anyway, it is old. I guess the obvious ask would be if a more modern version might be a possibility (e.g. I tried ES6 syntax, and it was a no-go). On the "title", the problem with the "standard" solution you propose is that I could not work out how to combine $F{text} with $F{name} to allow a textfield containing '$F{text} + " " + $F{name}', since in this model, these two are associated with distinct datasets. The idea of my $F{top} is to sidestep this problem by allowing for '$F{text} + " " + $F{top}.get(...).....asText()'. The rather horrendous expression required to do the array lookup is the prime motivation for a newer JS. Note that I actually rearrange my JSON to use dicts instead of arrays by transforming [{"id": 1, ...}, {"id": 444, }, ...][/code]into dicts keyed by the id: {"1": {"id": 1, ...}, "444": {"id": 444, }, ...}[/code]to eliminate the array lookup and replace this: $F{top}.get("title").get(java.util.Arrays.binarySearch($F{top}.get("title").findValuesAsText("id").toArray(), "" + $F{title})).get("title").asText() + " " + $F{name}[/code]with this: $F{top}.get("title").get("" + $F{title}).get("title").asText() + " " + $F{name}[/code]which is, ahem, a bit nicer.
  13. Saving as rich text seems broken...I had to type the whole thing twice already. So all the bolding and the URLs are gone...
  14. I thought it might be helpful to write up how to use JSONQL and Javascript to "walk" a JSON datasource since I at least found this rather tricky. First, the key documentation seems to be The JSONQL query language and also the rather minimal Using JavaScript as a Language for Expressions. There are of course a number of helpful other articles but I did not find anything that made it clear how to do the kind of data walks/joins I needed to do. A small extract of my data illustrates the issue: { "employee": [{"title": 132, "name": "Fred", ...}, {}, {}, {}...], "title": [{"id": 132, "text": "Mr.", ...}, {}, {}, {}...],}[/code]and the requirement is that while walking "employee", I need to look up the "Mr." corresponding to "title" 132 so I can emit "Mr. Fred". Most documentation might tend to suggest the main dataset might use a query string of "employee" (or maybe "employee.*"...I'm not 100% clear on the difference!). The problem I had understadning how to do the walk was solved by using am *empty* main data set query string along with a single field definition corresponding to the top of the report: <queryString language="jsonql"> <![CDATA[]]> </queryString> <field name="top" class="java.lang.Object"> <propertyExpression name="net.sf.jasperreports.jsonql.field.expression"><![CDATA["$"]]></propertyExpression> <fieldDescription><![CDATA[Top level object]]></fieldDescription> </field>[/code]Note how the type is java.lang.Object, not a more common simple type (more anon). Then, for each subDataSet, I'd specify the fields of interest, plus an identical $F{top}: <subDataset name="Employees" uuid="114e4562-7ddd-4e31-85d2-eb8177c7fbd1"> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="JSON data adapter"/> <queryString language="jsonql"> <![CDATA[employee]]> </queryString> <field name="name" class="java.lang.String"> <property name="net.sf.jasperreports.json.field.expression" value="name"/> <fieldDescription><![CDATA[name]]></fieldDescription> </field>... <field name="title" class="java.lang.Integer"> <property name="net.sf.jasperreports.json.field.expression" value="title"/> <fieldDescription><![CDATA[title]]></fieldDescription> </field> <field name="top" class="java.lang.Object"> <propertyExpression name="net.sf.jasperreports.jsonql.field.expression"><![CDATA["$"]]></propertyExpression> <fieldDescription><![CDATA[Top level object]]></fieldDescription> </field> </subDataset>[/code]This approach means that $F{top} can be used anywhere one likes to do things like this: <datasetRun subDataset="Employees" uuid="8771c862-35e8-4835-8e44-89acf7016e02"> <dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}.subDataSource("employee.*")]]></dataSourceExpression> </datasetRun> <jr:listContents height="46" width="380"> <textField> <reportElement x="0" y="0" width="70" height="30" uuid="34f5ebdd-08b6-478d-b281-e1fc47276717"/> // // Normal stuff // <textFieldExpression><![CDATA[$F{name}]]></textFieldExpression> </textField> <textField> <reportElement x="70" y="0" width="100" height="30" uuid="7a2569f5-7487-4f8e-8e53-70c104159290"/> // // Combine $F{title} with $F{top} to "join" the "title" array. // <textFieldExpression><![CDATA[$F{top}.get("title").get(java.util.Arrays.binarySearch($F{top}.get("title").findValuesAsText("id").toArray(), "" + $F{title})).get("title").asText() + " " + $F{name}]]></textFieldExpression> </textField> </jr:listContents>[/code]This works because the result of the java.lang.Object lookup is in fact a com.fasterxml.jackson.databind.node.ObjectNode, which has the predictable friends TextNode, and ArrayNode etc. Now that look pretty horrid (but it is in fact quite simple in its parts), so the question is could this have been expressed more cleary using ES6's Array.from() and .filter() etc? Or put another way: what version of JS does Jaspersoft support? That's my question too... Also, any suggestions on better ways to do the above are most welcome. Thanks, Shaheed P.S. I also tried ES5's indexOf, and got confusing results. Then again, I've forgotten what little I ever knew of JS and Java, let alone Jaspersoft.
  15. OK, from what I can see in the debugger, I *think* Jaspersoft is getting confused between the loaded bytecode for the main and child datasets. The first clue for this is actually in the exception message: note how the error message refers to "name$2" and "name": IIRC, this is typically used for nested classes. The second clue is that in the debugger, when I step into JRClassLoader.loadClass for the main dataset, the byte array containing the class code, when viewed as text looks like this: Note the reference to "HashMap<Ljava/lang/String;Ljava/util/Map<Ljava/lang/String;Ljava/lang/String;>;>;>". This is part of the definition for the sub dataset, NOT the main dataset. Of course this is just a guess on my part, but I am really beyond my rusty knowledge of Java...
×
×
  • Create New...