jasper server conditional mandatory on input controls - jasperserver

My question relates to jasper server 3.71
How can I conditionally make an input control mandatory. I wish to force the user to select from one query or another. In my case they must select from a list of Divisions OR from a list of Clients.
With thanks
Mark

This is not directly supported, however you could use a scenario where you define a third parameter which checks if either one or the other parameter is set. If the configuration is invalid you show an error message within the report instead of data.
Parameters:
parameter1, type: string, default value: none - deployed as input control
parameter2, type: string, default value: none - deployed as input control
verification, type: Boolean, default value: $P{parameter1} != null || $P{parameter2} != null - not deployed as input control
Band/Field Configurations:
As printWhen Expression of the detail band you add $P{verification} that means it will only be shown if the default expression for the verification parameter is true.
Define a text field in e.g. the title band giving an error message that either one of parameter1 and parameter2 need to be filled.

Related

How do reset groupFirstKey QueueConfiguration field to default value (null) via ActiveMQServerControl.updateQueue(String queueConfiguration)

I created a queue via the method ActiveMQServerControl.createQueue(String queueConfiguration) with a value for the groupFirstKey.
How to reset groupFirstKey field of QueueConfiguration this queue to default value (null) via ActiveMQServerControl.updateQueue(String queueConfiguration)?
If I set "" for groupFirstKey in the String queueConfiguration (for example {"name":"MAXC","address":"MAXC","routing-type":"ANYCAST","group-first-key":""}), then for the groupFirstKey value I get not null, but "", respectively.
Currently there is no way to do this via the management interface (i.e. using the ActiveMQServerControl) because ActiveMQServerControl.updateQueue(String queueConfiguration) ultimately performs a check on the members of the JSON input that is passed in, and any members that are null (i.e. don't exist) are not updated.
However, if you're using an embedded server then you can use the updateQueue(QueueConfiguration, boolean) method directly on org.apache.activemq.artemis.core.server.ActiveMQServer and pass true for the boolean to force any null parameters to be used for the update.

how to disable 2nd parameter we select 1st parameter in crystal reports

Please guide how to do this requirement.
I Have a report having 2 command level parameters a and b.
If they select any of the one parameter then other one should be disabled/should not ask any value to enter /should not take any value .
Please suggest how to do
Command don't support optional parameters. Moreover, you can't disable or hide a parameter based on another parameter's value.
Your best option is to create a parameter that has a default value that will be 'ignored' by the query.
For example, given this Access command:
SELECT *
FROM customer
WHERE region='{?Region}'
with this parameter:
you will note that the parameter's Optional Prompt setting is false (and not editable):
Instead, you will need to a default, something like 'ALL' (or -1, in the case of a numeric value):
Modify the command accordingly:
SELECT *
FROM customer
WHERE ( '{?Region}'='ALL' OR region='{?Region}' )
This should be a feature of the user interface. You can implement it if you write your own software. The only viewer , which MIGHT be able to do this is R-Tag (www.r-tag.com). But even it will need to do some workaround ( if can do it at all). This behavior is very unique. Why would you need to have it ?

Default Value for report

I'm trying too see how JasperReports Server gets the default value set in a report. I know how to set a default value in iReport, but I'm trying to come with a way to check for that value programmatically in Java.
In particular, I'm interested in a List of Values Single Value Radio Select, I am using a Resource Descriptor to get other Report data, but this seems to elude me. Any help at all would be greatly appreciated.
To set default value in case of null, you can do this
((!$F{field_name} == null) ? '0' : $F{field_name})
To get parameter type you can do
JRParameter[] params = jasperReport.getParameters();
for(JRParameter param : params) {
param.getName();
param.getDescription();
param.getDefaultValueExpression();
param.getNestedType(); // get parameter type that can be list, string
}
For detailed reference regarding Resource Descriptor you can check, they have given complete example http://jasperserver.sourceforge.net/docs/3-5-0/JasperServer-Web-Services-Guide.pdf

Enter a query in a default value expression

In Jasperreports I would like to enter a Default Value Expression to a Parameter as a Query string to be able to dynamically provide the user with a default value that is correct, but not force him to choose it.
Is there anyway?
I guess the result should look something like this (even though it doesn't work):
I am using this for a form with a single-value selection method (the user can write which ever number he/she wants but I want the default value to be selected from the database).
Here's how I handle this:
The user selects a value from an input control (in my example, I will call it $P{time_toggle}). Then, I have another parameter ($P{time_constraint}) that takes the user input from $P{time_toggle} and decides what SQL string to inject into the main query based on it. The default value expression for $P{time_constraint} looks like:
$P{time_toggle} == "rolling_quarter" ? "..." : (
$P{time_toggle} == "rolling_30_days" ? "..." : (...
)
)
Then, in my main report query I reference $P{time_constraint}:
SELECT * FROM tblTable WHERE $P!{time_constraint}
To set a default time period, I set the default value expression for $P{time_toggle} to my desired default.

How does one pass null values to optional parameters in a Business Objects report using the Business Objects SDK?

I am building a web front end for accessing Business Objects reports using the Business Objects SDK for .NET. I have been able to hack my way through 95% of the business requirements with the sparse documentation and forum posts available online for the topic. My final roadblock centers on working with parameterized reports. Our business has situations in which a report has two parameters and the end user is only requried to populate one of them. It's easy enough to collect and cleanse this data, but no matter how I try to pass the null valued parameter to the reports, I get no data back. If both parameters are populated I DO get the expected data. When stepping through the code in Visual Studio I see that whenever BusinessObjects returns a null valued parameter it displays as an empty string (""). I have tried passing this as a parameter value and have also tried assigning the parameter a value of null. Neither of these options returns results once the report is scheduled and run. I have an example of my parameter assignment code below using each of the approaches that I've taken (We need to check for a string valued "null" as the user's have requested the ability to type "null" and have that passed to the report). None of these produce a report that contains data.
sVal.Value = param.ParameterValue != "null" ? param.ParameterValue : String.Empty;
sVal.Value = param.ParameterValue != "null" ? param.ParameterValue : "";
sVal.Value = param.ParameterValue != "null" ? param.ParameterValue : null;
Is there a specific value that the Enterprise Server uses to indicate null, such as dates are required to be wrapped in Date()?
Edit: The functionality I need to duplicate as seen in InfoView:
In Web Intelligence, by default all prompts are required and you must provide a value for it via the SDK. As of BusinessObjects XI R3 it is possible to actually configure the prompt in the report to be optional. This configuration is done by the report writer. When the prompt is optional then you can opt to not set the prompt value when working with the SDK.
An alternate way to have an optional prompt is to make the prompt "matches pattern" or if it is a date, figure out a default value. When the prompt is meant to be optional and is "in list" then you can set the value to be "%" which, while for a date, set the default value.