Jasper built-in functions do not work - jasper-reports

I'm creating reports using Jasper and JasperSoft Studio. It's a maven springboot application.
The reports work good. Also the data connection works as it should.
I only have problems with the built-in functions (like sum(), trim(), replace(), ...). Also I'm not able to write custom functions. When I call one of those functions, an error appears on generating the report. Following the message:
1. The method REPLACE(String, int, int, String) is undefined for the type report_1475756642067_881680
value = REPLACE(((java.lang.String)field1.getValue()),2,5,"test"); //$JR_EXPR_ID=65$
All works fine in Jaspersoft studio, the error only appears when I generate the report.
In Jaspersoft Studio all required external libraries are added.
Does anybody have any ideas?

Try to set groovy for report's property language <--- This is the answer to all your problems, don't ask me why it just works!!!

Related

How to control the WebTau report

When I first used WebTau it would produce a report file in the project directory where the WebTau tests were being run. Tests that use WebTau are no longer generating a report.
Is there a way to (manually) conrol when the report is produced?
Can I specify an output directory for this report?
Also, there is another question as to how I managed to change things and the report is no longer being generated automatically? I have moved some common code patterns into a TestingSupport project, because I found a bunch of tests were almost cut-n-paste at this ealry stage. There's no report file appearing in another directory though.
Another potential explaination is that I commented-out the #WebTau annotation on my test Class. I did that when I moved REST calling patterns to a library class. Everything works fine, of course there's no report. I'm guessing that is going to be a clue.
#WebTau annotation is essential for JUnit5 to generate the report. You need to annotate any class that you want to participate in the report.
Alternatively you can try to register global WebTau extension org.testingisdocumenting.webtau.junit5.WebTauJunitExtension following this JUnit5 guide: https://www.baeldung.com/junit-5-extensions#1-automatic-extension-registration
Use reportPath config value to change the report location
It can be specified using config file or system property override or using environment variable

Table cell creation warning/error about IBlockElement

Just starting to try and use iText (latest version) and following some online examples. However, this bit of code in Visual Studio 2019, VB:
Dim cell1 = New Cell
cell1.Add("Name")
gives me an intellisense warning/error in the editor saying:
Runtime errors might occur when converting 'String' to 'IBlockElement'.
Why doesn't the cell.ADD argument accept strings as per online code examples please?
(I am also not well versed in using Interfaces either!)
Thank you
Why doesn't the cell.ADD argument accept strings as per online code examples please?
Apparently the online code examples you saw were created at the time of the early 7.0.x versions. But the whole table API has been overhauled in 7.1.0 including some breaking changes.
Thus, in the current version create an IBlockElement (e.g. a Paragraph) containing your text and add that block element to your table cell.

Validating parameters on Jasper report

When setting up parameters in Jasper Studio I cannot find a way to validate them. For example I have a string parameter but I want to ensure it is only numeric, or max length of 10, or not empty, etc. so when I try to run the report it stops me before it tries to call the SQL and shows an error instead?
I tried to use expressions and variables, and looked at scriptlets but they didn't seem to help and unless I'm searching wrong I can find nothing in the documentation or online. Surely parameter validation, even basic stuff, in a report or on the Server is a common action?
I appreciate when doing it via the API you provide your own, but when using Studio to design for the Jasper Server there must be a way to include validation simply?
thanks for any help.

How to reference COM lib like shdocvw using vbc commandline compiler (no IDE)?

The basis of this question comes from this tutorial on support.microsoft.com:
http://support.microsoft.com/kb/176792
To run the following code, it is necessary to add a reference to
"Microsoft Internet Controls" (Shdocvw.dll) and "Microsoft HTML Object
Library" (Mshtml.dll) to the Visual Basic project:
Dim SWs As New SHDocVw.ShellWindows
Dim IE As SHDocVw.InternetExplorer
This works fine in Visual Studio 2010, but it seems to rely on some behind-the-scenes magic that I can't duplicate using the straight commandline vbc compiler.
Obviously there is no "Add Reference" dialog for the commandline compiler. I naively tried adding:
/reference:"C:\windows\system32\shdocvw.dll"
to the commandline, but that didn't help. In both cases, I get:
error BC30002: Type 'SHDocVw.ShellWindows' is not defined.
error BC30002: Type 'SHDocVw.InternetExplorer' is not defined.
I've successfully used shdocvw.dll, AKA Shell.Application, from other languages like vbscript and autohotkey, but I currently have too little understanding of VB.NET to know whether I'm just doing it wrong or it's not possible.
You will have to run the Tlbimp.exe utility first. That's the tool that generates the interop library from the type library embedded in shdocvw.dll, normally done automatically when you add the reference in the IDE. It produces interop.shdocvw.dll, the one you need to pass with the /reference option.

Custom Domain visualization

I'm storing .NET TimeSpan objects in a SQL Anywhere database as their underlying .NET implementation type, a 64-bit integer. I've even created a custom domain called "timespan" to do so.
When debugging in Visual Studio, you can override the default ToString() for the debugger window so that it shows what you want. I'm looking for a similar capability in SQL Anywhere.
Does anyone know if there's a way to specify a visualizer (or a format string, or anything) so that when interactively browsing a SQL Anywhere database, it will display a timespan value of 600000000 as 00:01:00.00 like it would in Visual Studio?