justin.watts Posted April 10, 2018 Share Posted April 10, 2018 I'm trying to use the filter expression, but I can't find a formula that filters my data accordingly.I have one parameter (PlacementDays) and one variable (TotalPEIMSDays). They both are set to class BigDecimal. I am trying to say the following:When $P{PlacmentDays} is entered as 0, then show me all records, else show me records where $V{TotalPEIMSDays} >= $P{PlacementDays}(based on input by user).How do I accomplish this? Link to comment Share on other sites More sharing options...
riodavid Posted April 11, 2018 Share Posted April 11, 2018 What is your query to retrieve data? Is it a SQL, a stored procedure, or something else? Link to comment Share on other sites More sharing options...
m.kamran Posted April 11, 2018 Share Posted April 11, 2018 In your expression editor,IF($P{PlacmentDays} == 0,$F{your_field_here}, IF($V{TotalPEIMSDays} >= $P{PlacementDays},$F{your_field_here},/* whatever you want for else*/))works like this,IF (condition, true_outcome, false_outcome) Link to comment Share on other sites More sharing options...
justin.watts Posted April 12, 2018 Author Share Posted April 12, 2018 I am using SQL to retrieve data. It seems I'm making it harder that it should be. All I want to say is show records based on the following formula:Where $V{TotalPEIMSDays} >= $P{PlacementDays}Both the variable and parameter are set to Integer class. $P{PlacementDays} is just the parameter input for the user. $V{TotalPEIMSDays} is a created variable by taking the sum of a field pulled from the SQL (ACTUAL_PEIMS_DAYS, which is also set to Integer). Link to comment Share on other sites More sharing options...
justin.watts Posted April 13, 2018 Author Share Posted April 13, 2018 I think the issue I am having is I'm trying to do == in one part of the expression and then do >= in another part of the expression, which I haven't found out how to do successfully. Is there a way to simply say $V{TotalPEIMSDays} >= $P{PlacementDays}? What class do the variables and parameters have to be? I Link to comment Share on other sites More sharing options...
m.kamran Posted April 16, 2018 Share Posted April 16, 2018 Hi Justin,Of course you should be using a number data type for such comparisions. Use Integer, Decimal etc. depending on the type of data you are expecting.Thanks. Link to comment Share on other sites More sharing options...
justin.watts Posted May 16, 2018 Author Share Posted May 16, 2018 I tried the following expression, but getting an error that integer cannot be cast to boolean. Both the $P and the $V are set to integer class; will not work with bigDecimal either.IF($V{TotalPEIMSDays} >= $P{PlaceLimit},$V{TotalPEIMSDays},$V{TotalPEIMSDays}) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now