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

jgust

Members
  • Posts

    206
  • Joined

  • Last visited

  • Days Won

    1

 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 jgust

  1. You can use the 'equals' method also it looks like the STATUSID is a string and should be wrapped in quotes. $F{REQID}.equals( 16 ) && $F{STATUSID}.equals( "01" ) ? 1 : 0[/code]Here is the same expression this time with multiple conditions: $F{ReqID}.equals( 16 ) && $F{statusID}.equals( "01" ) ? 1 : $F{ReqID}.equals( 16 ) && $F{statusID}.equals( "02" ) ? 2 : $F{ReqID}.equals( 17 ) && $F{statusID}.equals( "03" ) ? 3 : 0[/code]
  2. This stackoverflow answer says the issue is with the different datatype between the parameter and the database: https://stackoverflow.com/questions/14950970/jasper-reports-error-executing-sql-statement-for
  3. In the screenshot below I have further defined my PM_M_CAMP_ID parameter to be a string. This isn't actually needed just good hygiene as anytime I need to look at the parameter Jasper will know it is an array of strings and provide me with the appropriate context.
  4. What I would do is force the data to reflect the number of pages you need. In this case, you need five rows. The below example is for Oracle. I'm sure you can find an equivalent in other languages using a temp table and CROSS JOIN to simulate the forced row aspect. With FiftyRows as ( SELECT LEVEL AS PALLET , 2000 AS QUANTITY , 2000 * LEVEL AS TOTAL_QUANITY FROM DUAL CONNECT BY LEVEL <= 50)SELECT *FROM FiftyRows where TOTAL_QUANITY <= 9500UNION ALL SELECT MAX(PALLET)+1 AS PALLET , (9500 - MAX(TOTAL_QUANITY)) AS QUANTITY , (9500 - MAX(QUANTITY)) + MAX(QUANTITY) AS TOTAL_QUANITY FROM FiftyRows where TOTAL_QUANITY <= 9500;/*PALLET QUANTITY TOTAL_QUANITY1 2000 20002 2000 40003 2000 60004 2000 80005 1500 9500*/[/code]
  5. In order to change the parameter from a single value to a multi-value, you will need to modify the class from 'java.lang.String' to 'java.util.ArrayList'. Both OrganizationalUnit and VisitStatus parameters are set up that way. Second, you can change the nested type to a more specified class type of 'java.lang.String'. Finally, you can initialize your own list of values by adding the following to the default expression: Arrays.asList("* All Management Groups"). Once you have the parameter setup then you will need to modify your SQL to treat the parameter as an array and utilize the IN sql syntax. ($X{IN,"mg."management_groups",MagementGroup} OR $X{IN,'* All Management Groups',MagementGroup})
  6. The swap file is a mechanism to offload memory that java has access to so that you don't exceed the limit. It is not formatted data but a dump of memory. Excel, on the other hand, is not only data but a zipped XML file. The two are not the same.
  7. You can use the built-in TEXT() function to convert the number to a string. $P{timeQty} >= 1 && $P{timeQty} <= 7 ? "1 week" : $P{timeQty} >= 8 && $P{timeQty} <= 14 ? "2 week" : $P{timeQty} >= 15 && $P{timeQty} <= 21 ? "3 week" : $P{timeQty} >= 22 ? "4 week" : TEXT($P{timeQty},"#,###")[/code]
  8. How do you limit your results based on the results of an aggregate? In Crystal I would add a "Group Selection". In SQL I would add a "Having Clause". What is the equivalent in Jasper?
  9. Let's say you have a boolean parameter called $P{ShowTableA} with a default value of 'true'. <parameter name="ShowTableA" class="java.lang.Boolean"> <defaultValueExpression><![CDATA[true]]></defaultValueExpression> </parameter>[/code]Depending on the value of that parameter you can use the "Print When Expression" on the subreport to suppress or show it. This condition will Show Table A $P{ShowTableA}.equals( true )[/code] This condition will show Table B $P{ShowTableA}.equals( false )[/code]
  10. You can create a Table1 and Table2 subreports. Then suppress depending on the parameter value.
  11. I don't know about server functionality but for the jrxml files, you can use a grep tool to find your specified content. In your case that would be items in the <queryString> tag. I used dnGrep for Windows with the settings below and was able to save the results to a text file for further review. Note that the regex the program uses is Microsoft's version of regex. There is a help file for the regex they use to assist you.
  12. I use that syntax in most of my reports. Here is how I use it. SELECT L.LEA_ID , L.LEA_NAME , C.CAMPUS_ID , C.CAMPUS_NAME FROM SCH_PEIMS_APP.V_R_PDM_LEA L INNER JOIN SCH_PEIMS_APP.V_R_PDM_CAMPUS C ON L.ACAD_YR = C.ACAD_YR AND L.COLL_NAME = C.COLL_NAME AND L.SUBM_NUM = C.SUBM_NUM AND L.LEA_ID = C.LEA_ID WHERE L.ACAD_YR = $P{psEnter Academic Year} AND L.COLL_NAME = $P{psEnter Collection Name} AND L.SUBM_NUM = $P{psEnter Submission Number} AND L.LEA_ID = $P{psEnter Organization ID} AND ($X{IN,C.CAMPUS_ID,PM_M_CAMP_ID} OR $X{IN,'* All Campuses',PM_M_CAMP_ID})[/code]If you're not getting the right data then I would say the issue may be that your array parameter may not have the expected values. If this is the case then you can create an expression to display all of the values in your array. This may help to verify. String.join(", ", $P{PM_M_CAMP_ID})[/code]
  13. Verify that your main and any subreports are set to horizontal. You can set that using the page layout property of the report level.
  14. Your attachment is a crosstab report. You can find the crosstab on the palette.
  15. I had a similar issue at work. There is a font requirement but when exporting to PDF the font was replaced. The issue for me was that Jasper defaults logical fonts used by JVM which are − Serif, SansSerif, Monospaced, Dialog, and DialogInput. You can force Jasper to use other fonts by modifying your preferences in Jasper Studio Fonts. You will need to package up the font you want to use and not only make it available to studio but also the server if you are not just running reports locally. This url has an old guide for doing this with a Thai font: http://www.adempiere.com/Using_Jasper_Report_Form_in_place_of_Standard_Forms
  16. I use the cross join with connect by all the time at work. Our usage is a little different than what you have. I don't have a need for a range instead I just need consistent n number of days/years. -- next five daysSELECT (CURRENT_DATE-1 + LEVEL) AS attendance_dateFROM DUALCONNECT BY LEVEL <= 5order by 1 desc;-- last five daysSELECT (CURRENT_DATE+1 - LEVEL) AS attendance_dateFROM DUALCONNECT BY LEVEL <= 5order by 1 desc;[/code]I modified the DR table to grab from parameter date and the next 5 days. select e.employee_id, e.initials || ' ' || regexp_replace(e.surname, '([^()]*)', '') farm_manager, r.research_station_id, r.name, dr.attendance_date attendance_date from research_station r inner join employees e on (e.employee_id = r.farm_manager) inner join employee_jobs ej on (e.employee_id = ej.employee_id) cross join (SELECT ($P{Date_from}-1 + LEVEL) AS attendance_date FROM DUAL CONNECT BY LEVEL <= 5) drwhere r.research_station_id = $P{Research_Station_id}[/code]
  17. If you know ahead of time that you want to suppress a band or subreport then @IAmLeo is correct that you can pre-emptively suppress it using the print when expression, either on the band or the subreport depending on your layout. If you want to suppress the subreport only if there is no data then I think what you need to do is set the "When No Data Type" field to "No Data Section" and make that section really small. Another option (I haven't tried this yet) would be to pass back a record count from the subreport using the Edit Return Values and see if you can suppress based on the return value. Like I said I haven't tried that yet. The "No Data Section" in the subreport has always worked well for me.
  18. jgust

    variable

    Use the "matchs" method to find if the field is numeric using a regex expression $F{TextMiles}.matches( "^[-+]?\b\d+[\.]?[\d+]" ) After that you can use DOUBLE_VALUE, FLOAT_VALUE, or INTEGER_VALUE built-in functions to convert the value. Here are the resulting IF expressions. Double: $F{TextMiles}.matches( "^[-+]?\b\d+[\.]?[\d+]" ) ? DOUBLE_VALUE( $F{TextMiles} ) : 0 Float: $F{TextMiles}.matches( "^[-+]?\b\d+[\.]?[\d+]" ) ? FLOAT_VALUE( $F{TextMiles} ) : 0 Integer $F{TextMiles}.matches( "^[-+]?\b\d+[\.]?[\d+]" ) ? INTEGER_VALUE( $F{TextMiles} ) : 0
  19. The syntax works so in order to debug you should comment out all of your WHERE conditions and add them one by one until you find your syntax error.
  20. I've done this in Crystal Reports several times but haven't' had the need to do it in Jasper just yet. I would imagine the process would be the same. This is how I would approach it. 1. Query for all possible data your end-user would need. 2. Create a parameter for each user-defined column you are allowing your end-user to populate ($P{Col1Field}, $P{Col2Field}...) 3. Create a variable or text field expression for each column 4. Populate the column based on the parameter values You can find an example in this answer: https://community.jaspersoft.com/questions/1197526/how-join-columns-jaspersoft-studio
  21. You can't have multiple page footers so a possible workaround would be to create multiple group footers with a print when expression tied to the page number. You can set the group footer position to Force at Bottom. Another possibility is to have a subreport in the page footer using empty row as the data adapter. You can then pass all your data and format in the subreport as needed.
  22. You can simplify the condition from the weird CASE and 1=1 to a simple OR statement. This is more readable. SELECT * FROM monthly_report WHERE type = $P{TYPE} AND ($P{REPORT_TYPE} IS NULL OR report_type= $P{REPORT_TYPE});
  23. This should be a simple task for the database to do. No need to over-engineer a scriptlet solution. Here is an example from Oracle to convert a number into a string. Other databases have similar functionality. If it a repeated function then maybe a db function is the way to go. select 483 as MyNumber , to_char(483,'RN') as Roman_To_String , to_char(to_date(483,'J'), 'JSP') as Julian_To_String , to_char(to_date(31,'DD'), 'DDTH') as Day_To_OrdinalNum , to_char(to_date(31,'DD'), 'DDSP') as Spelled_Number , to_char(to_date(31,'DD'), 'DDSPTH') as Spelled_To_Ordinal_Num from dual; Version:0.9 StartHTML:-1 EndHTML:-1 StartFragment:000081 EndFragment:000896 MYNUMBERROMAN_TO_STRINGJULIAN_TO_STRINGDAY_TO_ORDINALNUMSPELLED_NUMBERSPELLED_TO_ORDINAL_NUM483CDLXXXIIIFOUR HUNDRED EIGHTY-THREE31STTHIRTY-ONETHIRTY-FIRST
  24. You can simplify the condtion from the weird CASE and 1=1 to a simple OR statement. To me this is more readable. SELECT * FROM monthly_report WHERE type = $P{TYPE} AND ($P{REPORT_TYPE} IS NULL OR report_type= $P{REPORT_TYPE});
  25. In my environment, we have prod, test, svn, JaspersoftWorkspace, local folder (not JaspersoftWorkspace), and shared network folder. If I copy a jrxml file from test to the local system Jasper Studio will try to compile and put the jasper file back in test where I copied the file from. How can I force the report to always compile to the same location as the jrxml file that I'm editing?
×
×
  • Create New...