Jump to content

Conditional / fixed fields


sugra

Recommended Posts

greetings,

Is there a way to set a condition for a particular field apart from in the query? For example, suppose I want a field/variable to sum the amount of products that fall under 2 categories Frozen Goods and Snacks, is there a way to set those conditions at the field level?

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

The idea is good. That might work in Groovy (I'm not sure). In Java this is not what you might think it is:
category == "Frozen Goods"

 

If the report is using Java syntax then you want something more like this:
(category.equals("Frozen Goods") || category.equals("Snacks")) ? ( $F{amount} ) : new Long(0)

 

Regards,
Matt

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