Validating parameters on Jasper report - jasper-reports

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.

Related

Jasper built-in functions do not work

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!!!

FileMaker MissingFunction

Set Variable [$Write; Value: <Function Missing>("filepath";$inputedText)]
I'm trying to determine what the missing function is. I'm trying to write data to an external file with this script, and this is one line of code from the script. I can't post the rest of the code for security reasons. Any direction as to what the missing function would be would be greatly appreciated.
The < Function Missing> message means that this code was written with the expectation that a now-missing plugin would be present. To resolve this, you'll need to determine which plugin this is, and install this on your development machine (and likely on all machines needing to use this script, unless you choose to write this to execute as a PSOS script running on the server).
My best guess based on functionality and the arguments being passed is that the missing plugin may be the Monkeybread Plugin.
It's the Write To File function in ScriptMaster

QTP fails to recognize Java-applet Jtree object when used with Regular Expression

I am using QTP for automating an application. QTP recognizes Java applet- JTree as a html tag. In the html tag we have a number which is dynamic.
Hence we used Regular Expression so that QTP recognizes the object even if the number changes. But QTP is failing to do so. We have tested the regular expression in the evaluator and it works highlights the correct number as expected.
The expression in Obj Repository matches with the one in the Expert view.
Reg expressions do not work with html tags/applets is it??
Is there any other way to deal with dynamic elements in html tags??
Thanks in advance.
Try using descriptive programming it may help you. If you could provide more details of the issue then i could send you code snippet.
You should try UFT that is the next generation of QTP.
If you have a QTP-Licence you can update to UFT and I guess it will work well.
On the other hand how long will QTP will be supported

Jasper Reports Custom global or built in parameter

In my application I have a setting that can be configured by the user called Date Format. There are a list of formats they can use and when they choose one, all dates in the application and in the reports use that format.
Every time I create a new report I have to create the parameter and link the input control. I just added a new setting, for formatting numbers. I have about 50 reports that I need to apply this to. After going through the monotonous task of adding the parameter and input control to every report I was wondering if there is an easier way.
Is it possible to create a custom global parameter that is automatically available to all reports (Similar to the built in parameters)?
Furthermore, is there a way to tell jasper if a field is of a certain type to automatically do something with it, on a global level. For example if my field type is 'decimal' apply the number format?
Every report has a REPORT_FORMAT_FACTORY parameter that is an instance of net.sf.jasperreports.engine.util.FormatFactory. You should be able to create your class that implements FormatFactory and in the constructor takes what ever you need to determine the correct format. Then add it to the parameters when exporting your report.
You will probably need to play with it, as I am not sure what it passes in for pattern when a value is/isn't set. And if you always ignore the pattern, then when you need to explicitly set it to be the same in all reports it will cause problems.
If I get time tonight, I will try to create an example and see how it works and update my answer, or if you beat me to it, you could post a comment letting us know how it works.

Powershell in SQLCLR?

In the past I've been able to embed a sripting languate (like JScript) inside the SQLCLR, so scripts can be passed as parameters of functions, to perform certain calculations. Here is a simplistic example (the function ssScriptExecute returns a concatenation of all the print's in the script):
select dbo.ssScriptExecute( 'print("Calculation: "+(1+2/3) );' )
-- Calculation: 1.6666666666666665
I'd love to be able to embed a Powershell runtime in the same way. But I've had all sort of problems because the runtime tries to find assemblies by path, and there are no paths inside the SQlCLR. I'm happy to provide more information on the errors I get, but I was wondering if anybody has tried this!
Thanks!
I use il code injection to modified System.Automation.Management.
make variable version in GetPSVersionTable() be "2.0"
then i can run Powershell Code in SQL Server.
Be sure reference this modified dll in your visual studio project.
http://www.box.net/shared/57122v6erv9ss3aopq7p
btw, automated registering all dll you needed with running powershell in SQL
you can use this ps1 code
http://www.box.net/shared/tdlpu1875clsu8azxq4b
I think the only way to do this is to create a WCF service hosting powershell, and let SQLCLR send the request dbo.ssScriptExecute(...) to that service for execution.
Besides from that, I've also successfully embedded paxScript.net in the SQLCLR (an interpreter that does not have the memory leak problems of the DLR languages).
I thought SQLCLR was restricted to just a certain set of assemblies and PS Automation is not one of them.