Jump to content
We've recently updated our Privacy Statement, available here ×

Condition with single option


dnvsrikanth

Recommended Posts

Hi Friends,

I want to use a condition in the expression of a variable. To use a condition we can use only ternary operator which has two options. But I want a condition which has only one option.

For example:

$F{Is_Moderator}.equals( "Y" ) ? $F{total_score} : new Integer(-1)

In this operator we have two options in which when the condition returns true, one value else another value.

But I want only one option in which the condition has only one option without else part.

Thanks in Advance,

DNV Srikanth.

Link to comment
Share on other sites

  • Replies 8
  • Created
  • Last Reply

Top Posters In This Topic

Why not

$F{Is_Moderator}.equals( "Y" ) ? $F{total_score} : new Integer(0))

A lot depends on what you finally want to do with the variable value as in what you want to display and how you are evaluating the variable (sum, average, etc).

 

 

Link to comment
Share on other sites

Hi,

I want to capture the value when thae condition returns true. I dont want the other part. In my application there are two cases in which the condition returns true and false. I want to capture the value only when the condition returns true.

Thanks,

DNV Srikanth.

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