editing jrxml documents using Ubuntu
Submitted by harrywever on Sat, 26/07/2014 - 11:47
I need to edit documents using Jasper and as I have Ubuntu on my computer I need to use terminal box and commands. I have forgotten the commands etc . If someone can refresh me on the process of editing the documents in Linux that would be greatly appreciated.
Harry
Re: editing jrxml documents using Ubuntu
Do you have GUI access to the ubuntu box or not?
ireports will install on a ubuntu machine and then you just download the file out of openvpms
Open openvpms - navigate to administration - templates.
Find the report/template you wish to change - click view - the report will have a link at the bottom click the link to download the report to your local machine.
open the downloaded file with ireports or the new Jaspersoft studio 5.6 available for linux most types, windows and mac.
http://community.jaspersoft.com/project/jaspersoft-studio
Save the file making sure the editor you are using saves it to be compatible with jasperreports 3.7.5.
navigate back to the same template in openvpms but this type click edit....upload the new report and your good to go.
For background info:
http://www.openvpms.org/documentation/csh/1.7/admin/template
Re: editing jrxml documents using Ubuntu
I've got JasperReports 5.6.0 up and running from this link, but can't find where or how to save for compatibility with jasperreports 3.7.5. Looked in project and workspace properties, as well as save as, but can't seem to find it. Any clues?
Regards Simon
Simon Slater
Registered Linux User #463789 @ http://linuxcounter.net
Re: editing jrxml documents using Ubuntu
Try Tools|Options - then the General Tab, then Compatibility - see below. Regards, Tim G
Re: editing jrxml documents using Ubuntu
Wondered why I didn't have a tools menu ... I've got Jaspersoft Studio 5.6.0 not Jasper Reports. Is Studio of any use to us? It does look quite fully featured.
Regards, Simon.
Simon Slater
Registered Linux User #463789 @ http://linuxcounter.net
Re: editing jrxml documents using Ubuntu
Found it, under Window>Preferences>Jaspersoft Studio is the compatibility save options. Simon.
Simon Slater
Registered Linux User #463789 @ http://linuxcounter.net
Re: editing jrxml documents using Ubuntu
Simon - I saw the Studio announcement when I downloaded iReport Designer 5.6 - they will End-of-Life iReport Designed in Dec 2015. My take is that both Studio and iReport do the same job - but their user interfaces differ. See http://community.jaspersoft.com/wiki/introduction-jaspersoft-studio. However, my reading of http://community.jaspersoft.com/wiki/jaspersoft-studio-features is that a number of the new features will be of no use to us until we upgrade OpenVPMS to be able to use them.
Regards, Tim G
Re: editing jrxml documents using Ubuntu
I'll ask this here, but if anyone thinks it should be a new thread, I'm sure that can be arranged.
When using Jaspersoft Studio to edit the standard A5 invoice report (brand inclusion, ABN etc), I'm getting 18 errors of these 3 types when printing from within OpenVPMS:
Failed to create report: Errors were encountered when compiling report expressions class file:
1. Cannot cast from Date to String
value = (java.lang.String)(((java.util.Date)field_startTime.getValue())); //$JR_EXPR_ID=12$
<-------------------------------------------------------------->
2. Cannot cast from Long to String
value = (java.lang.String)(((java.lang.Long)field_id.getValue())); //$JR_EXPR_ID=13$
<------------------------------------------------------->
3. Cannot cast from BigDecimal to String
value = (java.lang.String)(((java.math.BigDecimal)field_tax.getValue())); //$JR_EXPR_ID=22$
<-------------------------------------------------------------->
What I know about Java woudn't cover a 2 cent piece. Do these errors go back to Java, the report per se, or using Js Studio rather than iReport?
Regards, Simon
Simon Slater
Registered Linux User #463789 @ http://linuxcounter.net
Re: editing jrxml documents using Ubuntu
Simon - Step 1 is either for me to install JSS and have a play, or you install iReports Designer and see if the same problem occurs.
If I get time I will try to play with JSS - but it does feel like the very bleeding edge. If you are not familiar with iReports, it is probably best for you to use it instead of JSS - then at least those of us who are familira with iReports can answer your questions and show screen shots.
However, another thought: pull up a standard report that uses the SQL data connection, rather that the invoice you are playting with. Then you can run the report in preview mode in JSS - and if that works, import into OpenVPMS and see if it will run there.
But I do think that the 'use iReports' is really the way to go.
Regards, Tim G
Re: editing jrxml documents using Ubuntu
I'll do that, but where do I find iReports? The above link is what I followed to get JSS. Simon
Simon Slater
Registered Linux User #463789 @ http://linuxcounter.net
Re: editing jrxml documents using Ubuntu
Those errors will occur in Jasperstudio or Ireports (they have nothing to do with the designer you used)
ailed to create report: Errors were encountered when compiling report expressions class file:
1. Cannot cast from Date to String
value = (java.lang.String)(((java.util.Date)field_startTime.getValue())); //$JR_EXPR_ID=12$
Taking this as an example ....in java you have to tell it how to format a date as a string...so when u placed the starttime field on the report you have set the textbox it as a string....but the field is a date. - ie when you drop a field on a report it creates a textbox with a formula in it that will compile when the report loads...but you have to make sure if a field is a date then the text box is set to display a date as well
All the other errors are variations on this.
Jaspersoft studio is based on eclipse
Ireports was based on netbeans.
GO and check all your fields on the report and make sure the box matches the field you want to display OR write a java formula that converts it...ie starttime.getValue().tostring();
Re: editing jrxml documents using Ubuntu
http://community.jaspersoft.com/project/ireport-designer/releases
Re: editing jrxml documents using Ubuntu
Simon - I had a quick play with iReports 3.7.6 (which I have been using for a long time) and 5.6.0 (which I installed a couple of days ago).
If I do something like the error Ben suggests (ie declare the text field as String for a data field that is in fact Big Decimal), then I use preview [I am playing with the clinicial sales report which uses the SQL data connection and thus I can use preview]:
Now the 'engine' in OpenVPMS is of the 3.7.6 vintage - and hence if you try to print your A5 invoice, it will fail with the type of error that you are getting.
This indicates that I should not use 5.6.0 because it will cope with errors that the 3.7.6 engine in OpenVPMS will not cope with. Thus if I build a new report using 5.6.0 and preview works, this does not guarantee that it will work when I run the report in OpenVPMS.
I suspect the same applies with JSS.
Note that for me, the most common way to cause the mismatch in data types is to copy and paste a display field. I commonly copy a text field that displays data field that is a string and then in the new pasted text field, change the data field it displays to something that is a number, and forget to change the type to match.
Regards, Tim G
Re: editing jrxml documents using Ubuntu
Thanks guys, I'll get iReports going this afternoon (too tired last evening and held up at church this morning).
What I did with JSS was just insert brand and change fonts on the fields. No new fields nor changes to the actual links/references/expressions of the existing ones. That's why I was puzzled over the source of the issue. After a closer look at the errors, it was 6 fields on the main report only, with the errors repeating 3 times.
Regards, Simon
Simon Slater
Registered Linux User #463789 @ http://linuxcounter.net
Re: editing jrxml documents using Ubuntu
If you didnt select the correct version to save as it will sometimes update field types automatically.
Even if you then go back and save it as the correct version(3.7.5) it will not correct the previous changes.
I am going to propose we update the jasperreports engine in 1.8 to 5.0.1 or near there - the changes should be able to be implemented and maintain backward compatibility.
Re: editing jrxml documents using Ubuntu
When I found it in JSS, I set it to save to the appropriate version by default with a confirmation, so I know each time.
I found iReports 3.7.5 here: www.http://sourceforge.net/projects/ireport/files/iReport/iReport-3.7.5/ , have it running and starting to play with it. Found some useful video tutorials for an overview.
When I load an existing report and look at the report query, the report fields are listed, the parameters have the data source, but no query, and an error when previewing records of: Report Design not valid: 1. Java.lang.ClassNotFoundException: org.openvpms.report.jasper.IMObjectCollectionDataSource
I guess I haven't linked the data source properly. It is set up because I can query and create a new report from it.
Regards, Simon
Simon Slater
Registered Linux User #463789 @ http://linuxcounter.net
Re: editing jrxml documents using Ubuntu
Many reports do not use SQL they use a Databean datasource. You wont see any sql in those reports
I wouldnt use ireports 3.7.5 - I use 5.1 and more recently 5.6 -
Re: editing jrxml documents using Ubuntu
Thanks Ben, I've seen the term databean in a menu somewhere, but I'll leave that alone for now. I won't be adding fields, just brand and font changes, but that still leaves no preview within iReports.
The selection of version 3.7.5 was after reading TimG's comment about versions and engines ( http://www.openvpms.org/forum/editing-jrxml-documents-using-ubuntu#comme... ). I thought I'd go back to the same version that works with the OP engine. Having never used it, I don't know what I'm missing in the newer versions. Any of the early 5 series iReports work well though, with saving to old version of course?
Regards, Simon
Simon Slater
Registered Linux User #463789 @ http://linuxcounter.net
Re: editing jrxml documents using Ubuntu
Yes the 5.x version work fine when you set to save as version 3.7.5, they run better with less bugs as well
You cant preview databeans based reports but you can preview the sql reports
Re: editing jrxml documents using Ubuntu
G'day all, guess what, I've hit another snag.
Got iReports 5.5.1 up and running, creating reports with brand, exporting to pdf etc. However, when editing the distributed invoice a5.jrxml, I get the error in OP: Failed to generate report: Byte data not found at location
Only found one reference in the forums: http://www.openvpms.org/forum/printing-problem#comment-4531 . The image is definitely in that location, here is the relevant xml that references it:
<image scaleImage="RetainShape">
<reportElement x="0" y="0" width="361" height="70" uuid="18b7e06a-95c8-4233-9d0e-6c41f708c462"/>
<imageExpression><![CDATA["/home/simon/JaspersoftWorkspace/MyReports/pstvlett-a5p-num.png"]]></imageExpression>
</image>
</band>
</title>
So I added that directory to the classpath in iReports as per: http://www.coderanch.com/t/63485/open-source/Referencing-image-Jasper-Re... by adding it path to Tools|Options|Classpath|Add Folder but still the error.
If I were to use a parameter as per the last post here: http://community.jaspersoft.com/questions/519026/failing-load-images-byt... what should I use as the parameter Default Value Expression?
Have I missed something obvious?
Regards, Simon
Simon Slater
Registered Linux User #463789 @ http://linuxcounter.net
Re: editing jrxml documents using Ubuntu
My version which runs on Windows is double slashed
<image hAlign="Center" vAlign="Middle" onErrorType="Icon">
<reportElement stretchType="RelativeToBandHeight" x="3" y="1" width="529" height="179"/>
<imageExpression class="java.lang.String"><![CDATA["C:\\OPENVPMS\\current-release\\reports\\Header.jpg"]]></imageExpression>
</image>
Re: editing jrxml documents using Ubuntu
Got it! Put the image in /var/lib/tomcat/webapps/openvpms/images/ and it finds it.
The earlier field type errors I found occurred not when editing the fields, but when adding or some editing to the image.
Regards, Simon
Simon Slater
Registered Linux User #463789 @ http://linuxcounter.net
Re: editing jrxml documents using Ubuntu
Simon I suspect that the user TOMCAT runs under cannot acces documents or items in the Userspace
/home/Simon
ideally they would be placed in
/home/TomCatUser/images for example.