Setting the reports directory in 5 - Newbie

Hi,

I am new to Jasper reports. I have got ireport working and save a report.

I have installed the jasper plugin into servoy 5, but putting the files in the plugin folder.

I have put a report into a jasperreports folder and set the as “jasperreports” in the plugin settings of my development servoy admin.

i have put a report into it, but when i ask servoy to give me the properties of the report it just says :

No jasperReport report7.jrxml has been found or loaded in directory jasperreports

The directory is in the application_server/server/webapps/ROOT/
folder
It must be in the wrong place?!!

I have tried it in the root of servoy but that doesnt work either.

Where does it go?

David

Hi David,

you can put the report in any directory on the server disk, but you need to tell the plugin where it is located.
Go to servoy-admin page, in the Servoy Plugins page and set the value of the “directory.jasper.report” property (located under the jasperPluginRMI part) to the (absolute) path of the directory that contains your reports. Then restart Servoy, and you’re all set!

dpearce:
Hi,

I am new to Jasper reports. I have got ireport working and save a report.

Hi there.
Patrick told you where to set up the report path.

If you have any more questions according iReport feel free to ask me.
I am quite familiar with it by now.
(Had to do a huge Report on my own)
The Forum of jasper is quite a pain in the ass. I found, that the answers you get there are not very satisfying.

So long

Jan

Thanks Jan,

It is a bit of a baptism of fire!

After about 3 hours i managed to create a summary column by group that displayed at the end of each group (as at the beginning it hasnt caluclated yet!)

I have then managed to get some parameters set-up, so i thought i would move on to Servoy.

In my time before the day job this morning i managed to get the plugin seeing the jasperreports directory that i had setup, well the error went anyway.

The script where i asked for the report parameters seemed to do nothing and an application.output command after the line didnt seem to work, so I am not sure i have things set-up properly.

Am i right to assume that all i should need apart from ireport is the jasper plugin and folder in the plugin directory of servoy.

I dont need a jasper reports server or anything else running? Unfortunately the servoy tutorial is done in servoy 3 not 5 and when ireport was a bit more primitive, so there doesn’t seem to be a servoy 5 idiots (and i am an idiot) guide.

Thanks for your help

David

Weeeelllll…

Here we go.

You only need the jasper servoy plugin to get it to work.
The plugin ships with the java libraries you need, to run a report (jasperreports-3.0.0.jar, and so on). So this is the “server”.
What you have to do are the following steps:

Download the Plugin.
Use the Basic plugin to start with.

Put the content of the plugin folder in :
<install_root>/servoy/application_server/plugins
AND
<install_root>/servoy/developer/plugins

If the server/developer is running, restart it, so they can initialise the plugin.

Go to your application_server Admin Page.

Select Server Plugins.

There you will find:

jasperPluginRMI
directory.jasper.report:

Set it for example to:
C:\report (win)
or
/home/report (linux)

Thats where you have to put your *.jasper files.

In Servoy you need to place a button (or whatever you want to fire the report from) and connect it to the Plugin.

e.g.
plugins.jasperPluginRMI.jasperReport(forms.customers.controller.getServerName(),‘myCustomerReport.jasper’,null,‘view’,{pcustomerid: forms.customers.customer_id});

If you need more examples, just look in the solution explorer of Servoy.
There is a plugin node.
In that node, there you will find the jasper plugin.
click once on the runReport method.
Right above the plugin Methods, there are to pictures of textfiles with yellow arrows.
Click the left one! (on Mouseover there will be a tooltipp telling you Move Sample Code)

You will see, that there will be plenty of code in your script.

I hope this qas “dummy” enough for you ;)

Long Live an prosper!

Jan

David,
What are you attempting to do with:

The script where i asked for the report parameters seemed to do nothing and an application.output command after the line didnt seem to work, so I am not sure i have things set-up properly.

Are you using the jasperreports plugin to retrieve the report parameters of a specific report that is in the reports directory that you set up in the admin pages?
Or are you attempting to pass parameters to the report and then run it?

I have a couple of tips about parameters for use within the report that might prove useful for you to read:
http://www.prospect-saas.biz/jasper_parameters.html

There is also of course the video of the intro to Jasper Reports at the Servoy Camp

Thanks,

i am trying to pass some parameters to it, although i think i should take one step backwards and get it simply showing the report so i know i have the plugin working first.

I will check out your link, many thanks for that.

David

OK, the dummy is still missing something!

  1. I have put the plugin in both directories. Both the plugins directory in developer and also the plugins directory in the application_server.

2 files and a folder entitled - servoy_jasperreports a jar and a jar.jnlp file.

  1. I have crerated a report which now doesnt use parameters in ireport. It works in ireport. i have compiled it and put it in the jasperreports folder i have put on my root hard drive.

  2. I have called the report with a single command - var success=plugins.jasperPluginRMI.runReport(‘practicemanager’,‘report7.jasper’,null,‘view’,null);
    it is definitely finding the file as if i change the name it comes up with an error.
    interestingly it doesnt seem to get to the next line as i have put an application.output line in application.output(‘–’+success);
    it never prints even --.

So when you hit the button it just goes grey and then nothing happens!

Any clues. I though i had got this sorted, but i cannot get a simple report up with no parameters.

Ta

David

See attachment.

A little Demo.

(veeery little)

Ps. Did you set the Report Folder in Servoy Admin Page?

jasperShow.zip (279 KB)

Thanks for this,

yes, it must be finding the directory as when i change the filename to one that isnt in there, it then gives a visible error.

It must be doing something weird as any lines beneath the plugin call do not run, but i get no error message from the plugin. I tried doing a pdf save and a print, but the same things happens, no result.

Looking at the forums, i took the itext out of the pdf_output plugin. The plugins in the developer solution folder look different to the application_server ones, but i still put the two files and the jasper folder in both as you suggested.

I even created a much simpler report, no params and just giving the output of one field on one table, still the button goes grey, nothing happens and when i move the mouse away it reverts.

Very Odd, i am convinced it must be the plugin installed incorrectly and maybe something to do with this itext.jar

Does developer retain any cached files? maybe the old itext is cached in the developer version when i run the solution from developer or something.

Anyway will try you version today!

David

OK,

fresh install of servoy, changing the itext plugin in pdf to 2 before running.

Your solution works fine!

Next step is to load my solution into this build and try it. I suspect it will work and may just be some settings or cached plugins on my home dev machine.

Many thanks

David

Getting there i think.

Wow! I think i have narrowed this down to an issue with my report format. Maybe I have not configured ireport properly

I have a report that i created in ireport using the mysql server my data is on. It works fine in ireport, but then just doesnt work in the same way in Servoy. it seems to vrash the script or exit it. T. Maybe i have not set-up ireport properly?

David

<?xml version="1.0" encoding="UTF-8"?>
<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="report1" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
	<queryString language="SQL">
		<![CDATA[SELECT
     providers.`name` AS providers_name,
     providers.`address1` AS providers_address1,
     providers.`address2` AS providers_address2,
     providers.`address3` AS providers_address3
FROM
     `providers` providers]]>
	</queryString>
	<field name="providers_name" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="providers_address2" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="providers_address1" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="providers_address3" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<background>
		<band splitType="Stretch"/>
	</background>
	<title>
		<band height="79" splitType="Stretch"/>
	</title>
	<detail>
		<band height="47" splitType="Stretch">
			<textField>
				<reportElement x="16" y="16" width="100" height="20"/>
				<textElement/>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{providers_name}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="126" y="16" width="100" height="20"/>
				<textElement/>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{providers_address1}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="247" y="16" width="100" height="20"/>
				<textElement/>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{providers_address2}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="381" y="16" width="100" height="20"/>
				<textElement/>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{providers_address3}]]></textFieldExpression>
			</textField>
		</band>
	</detail>
</jasperReport>

Switch the Language from Groovy to Java.

language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
       <field name="providers_name" class="java.lang.String">
          <fieldDescription><![CDATA[]]></fieldDescription>

See?

What a star!

To think six letters could cause all that heartache.

So Lesson 1. We dont like Groovy!!! in fact groov sucks.

Many thanks. I have my first Jasperreport, I am sure much more heartache is to come, but as always I take my hat off to the servoy community who put up and guide us part timers through the maze!

Many thanks Jan

David