B4J Library jJasperReports Library

Xfood

Expert
Licensed User
yes, he shows them to me, but he doesn't let me download the files., I downloaded the single files by searching on google, do you have any sample reports to start with? I find this tool truly fantastic
 

Juan Marrero

Active Member
Licensed User
Longtime User
I'll be changing the links to dropbox or something. Apparently there is a download limit of shared files in google drive free. I'll let you know when I'm done.
 

Xfood

Expert
Licensed User
Samples are in the first post. You have to create reports. I use JasperSoft Studio Community.
thanks, you could also attach the b4j example of the report as in the picture
 

Attachments

  • jrxml_subreports.png
    53.6 KB · Views: 242

Juan Marrero

Active Member
Licensed User
Longtime User
I could but they will be useless for you. The reports are linked to my databases so you won't be able to use them.
 

Xfood

Expert
Licensed User
I could but they will be useless for you. The reports are linked to my databases so you won't be able to use them.
an example with a small sqlite db, and a report similar to that?
it would be very useful to learn how to manage reports better
Thanks so much

p.s. the add-on library links from the first post still don't work for me.
 

Juan Marrero

Active Member
Licensed User
Longtime User
an example with a small sqlite db, and a report similar to that?
it would be very useful to learn how to manage reports better
Thanks so much
I don't remember if in the sample code there was a sqlite database. Will check.

p.s. the add-on library links from the first post still don't work for me.
I wrote about changing links to dropbox. Download times have been exceeded.
 

Juan Marrero

Active Member
Licensed User
Longtime User
great, it works Thanks. it would be nice to have some examples in b4j, I find this tool really good and professional
Just need to create a sqlite database with a single table with 2 or 3 columns. In JasperSoft you need to create a Data Adapter pointing to that sqlite database and then you will be able to add fields to the report and do a preview. Couldn't find the reports.
 

focus330

Member
Licensed User
Longtime User
Hello!

Very good work. I'm appreciating. But I have a problem: I have a report with an image. It may contain an image if a boolean field is true and another if false, This is the code in Jasper report
B4X:
$F{level}.toString().equals("true") ? $P{checkboxOK} : $P{checkboxNOK}
It works fine with Preview but when I call from B4j I have this error:

B4X:
net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
1. The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files
value = ((java.lang.Object)field_level.getValue()).toString().equals("true") ? ((java.lang.String)parameter_checkboxOK.getValue()) : ((java.lang.String)parameter_checkboxNOK.getValue()); //$JR_EXPR_ID=16$

what can I do? It seems a class is necessary.

Thanks
 

Juan Marrero

Active Member
Licensed User
Longtime User
What are checkboxOK and checkboxNOK? Are those parameters for what? For images to appear in report, you need to specify the full path of the image. I'm going to need more info on this. Java version, JasperSoft version (if using iReport can't help you there), the report itself, etc..
 
Last edited:

Juan Marrero

Active Member
Licensed User
Longtime User
Or maybe try this:
B4X:
($F{level}.equals(Boolean.TRUE.toString())) ? $P{checkboxOK} : $P{checkboxNOK}
But remember to create a parameter for the path of the image and use the function in JasperReports Library to assign the image's path to that parameter.
 

focus330

Member
Licensed User
Longtime User
1 Yes: CheckboxOK and CheckboxNOK are parameters for images.
2 TIBCO Jaspersoft® Studio 6.16.0
3 Using the grammar you suggested ...
B4X:
($F{level}.equals(Boolean.TRUE.toString())) ? $P{checkboxOK} : $P{checkboxNOK}
it runs fine. Thanks very much
SOLVED
 

Juan Marrero

Active Member
Licensed User
Longtime User
Perfect. I spent some time looking in forums about your error and found that suggestion. Glad it worked.
 

Num3

Active Member
Licensed User
Longtime User
Any chance this library can be updated to use the latest jasperreports_6.17.0.final.jar build?
It is already 10 revisions behind :\

And the:
B4X:
<textField textAdjust="StretchHeight">
Is not supported in this old version

I tried the renaming trick, but there are conflicts...
 
Last edited:

Juan Marrero

Active Member
Licensed User
Longtime User
Will put it on schedule. Don't have an estimate date. My 3yr old consumes most of my free time.
 

cjpryor

Active Member
Licensed User
Posting here because what I have to offer is relevant to this post. There is a way to solve the subreport location problem. You can add a parameter to the main report that holds the subreport directory and then add that to the subreport configuration in the main report. You can set the default value to your development directory (for testing in the JasperSoft development environment) and then pass in the deployment directory from your code at run time.

Here's how I did it.

1. Add SUBREPORT_DIR parameter to main report



2. Set default value to your development directory



3. In main report, configure subreport to use this parameter





4. In your code set this parameter to the deployed subreport directory

B4X:
        jasper.InitializeParameters
        '...
        '... I have additional parameters here that are not relevant to this illustration
        '...
        jasper.AddParameter("SUBREPORT_DIR", File.DirData("nmcollector/Reports") & "\")

5. Of course, make sure the subreport is in the directory. On a related note, I do not like to compile the subreport from the code. Instead, I compile it from Jaspersoft and deploy the compiled report to the deployment directory. Then I just call the main report and it in turn calls the compiled subreport.
 

Attachments

  • Dir_Param.png
    145.2 KB · Views: 236
  • Dir_Param.png
    145.2 KB · Views: 214
  • SubRptConfig_1.png
    202.1 KB · Views: 191
  • DirParam.png
    145.2 KB · Views: 186

Juan Marrero

Active Member
Licensed User
Longtime User
Very good aproach!!
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…