Jump to content
Changes to the Jaspersoft community edition download ×

How can I print different values in a field based on the values in parameter?


salemfahad
Go to solution Solved by hozawa,

Recommended Posts

Hi,

I want to implement shortcode in my report. For example, when a user inputs  'a' the field will show 'all'. Similarly, the field will show 'few' for 'f' and so on. Is there any way I can implement it without modifying my database? I want to accomplish this by using Jaspersoft Studio only.

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

  • Solution

Yes. There are several ways.

First is to use use Text Field and have if conidtion to choose what to display.

e.g.

$P{Parameter1}.equals("a")?"all":$P{Parameter1}.equals("f")?"few":"None"[/code]

Second is just to create layered Static Text components and use Print When Expression to choose which Static Text to display.

Third is to use scriplet to replace the value. If there are many reports requiring the same substitution, this may be the easiest to maintain.

Link to comment
Share on other sites

1. Open up a web browser.

2. Enter "https://www.google.com/"  as the URL

3. Enter "jaspersoft studio print when expression" to find out about "print when expression"

3. Enter "jaspersoft studio scriptlet" to learn about scriptlet.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...