2499
Views
15
Comments
Solved
If Statement in aggregate filter
Question

Hello,

I have an web block with an boolean input parameter and depending on the value, I want to apply a filter. Something like this:

If (Requested, Event.EventStatusId=Entities.EventStatus.Approved and Event.EventStatusId=Entities.EventStatus.Requested, Event.EventStatusId=Entities.EventStatus.Approved)

It's not working and gives me "Invalid use of "Boolean" in Filter." 

I'm not understanding why. 

2026-01-26 10-25-31
Lennart Kraak
Champion
Solution

Hi André,

In version 10 you can not use boolean variables as condition without comparing them to a boolean value.So then you've to add that in your filter, Requested = True

Event.EventStatusId = Entities.EventStatus.Approved 
or 
Event.EventStatusId = Entities.EventStatus.Requested and Requested = True
2019-08-08 09-29-47
Dharnendra Shah

Statement seems correct.I placed the same statement within webblock and its not giving me any error in web block preparation.


2019-06-18 18-34-57
André Vieira

That's strange... I don´t understand why it doesn´t work here...

2019-06-05 10-23-58
Andres Moreno

What is the "Requested" variables data type?

2019-06-18 18-34-57
André Vieira

Andres Moreno wrote:

What is the "Requested" variables data type?

Both of them are boolean.


2021-09-06 15-09-53
Dorine Boudry
 
MVP

Hi Andre,

can't help you with this problem, I tried little demo app and am able to use this filter, works as expected.  See attached oml, maybe you can spot the difference with what you are doing.

But I just wanted to add to this discussion, that I find the 'and' condition in the second part a bit odd, since a single event will probably not be both requested and approved at the same time.  You probably want this to be an or ?  Or am I reading this wrong ?

hope this helps,

Dorine


Edit : If I'm reading the requirement right : retrieve both requested and approved if parameter Requested is True, or else only retrieve approved

then that can be done with this filter, maybe that one will work for you :


Event.EventStatusId = Entities.EventStatus.Approved or Event.EventStatusId=Entities.EventStatus.Requested and InRequested
testsql.oml
2019-06-18 18-34-57
André Vieira

Dorine Boudry wrote:

Hi Andre,

can't help you with this problem, I tried little demo app and am able to use this filter, works as expected.  See attached oml, maybe you can spot the difference with what you are doing.

But I just wanted to add to this discussion, that I find the 'and' condition in the second part a bit odd, since a single event will probably not be both requested and approved at the same time.  You probably want this to be an or ?  Or am I reading this wrong ?

hope this helps,

Dorine


Edit : If I'm reading the requirement right : retrieve both requested and approved if parameter Requested is True, or else only retrieve approved

then that can be done with this filter, maybe that one will work for you :


Event.EventStatusId = Entities.EventStatus.Approved or Event.EventStatusId=Entities.EventStatus.Requested and InRequested

Hi Dorine,

yes I am using this filter to retrieve both requested and approved if parameter Requested is True or else only retrieve approved.


2021-09-06 15-09-53
Dorine Boudry
 
MVP

André Vieira wrote:


Hi Dorine,

yes I am using this filter to retrieve both requested and approved if parameter Requested is True or else only retrieve approved.


So then filter as I am proposing should work  :


Event.EventStatusId = Entities.EventStatus.Approved 
or 
Event.EventStatusId=Entities.EventStatus.Requested and Requested
2024-10-25 08-47-19
Eduardo Pires

Wich version are you using? 

In OS10 I've got the same error, but in platform 11 it seems to work.

2019-06-18 18-34-57
André Vieira

Eduardo Pires wrote:

Wich version are you using? 

In OS10 I've got the same error, but in platform 11 it seems to work.

Hi Eduardo.

I am using platform 10. So maybe that's the problem... need to find another way of doing this.


2019-06-05 10-23-58
Andres Moreno

You can do something like this:

(Requested and (Event.EventStatusId=Entities.EventStatus.Approved and Event.EventStatusId=Entities.EventStatus.Requested)) or (not Requested and Event.EventStatusId=Entities.EventStatus.Approved)

UserImage.jpg
Naren

Hello Andre,

What is your use case? What do you want to filter?

As per my understanding of your problem,Before the preparation of web block is rendered assign this if condition to a variable and use that variable in the filter of aggregate

2019-06-18 18-34-57
André Vieira

Hello Naren,

I have a checkbox in a screen assigned to a local variable (Requested, type boolean). And then I have a web block with that boolean as an input parameter. If the value is True, I want to show the Events that have the status Approved and Requested. If it's false only the Approved ones.

2026-01-26 10-25-31
Lennart Kraak
Champion
Solution

Hi André,

In version 10 you can not use boolean variables as condition without comparing them to a boolean value.So then you've to add that in your filter, Requested = True

Event.EventStatusId = Entities.EventStatus.Approved 
or 
Event.EventStatusId = Entities.EventStatus.Requested and Requested = True
UserImage.jpg
Naren

You can add something like this :

If (Requested=True, Event.EventStatusId=Entities.EventStatus.Approved and Event.EventStatusId=Entities.EventStatus.Requested, Event.EventStatusId=Entities.EventStatus.Approved)

or suggested by Dorine 

If (Requested, Event.EventStatusId=Entities.EventStatus.Approved and Event.EventStatusId=Entities.EventStatus.Requested, Event.EventStatusId=Entities.EventStatus.Approved)
2019-06-18 18-34-57
André Vieira

It is solved! Thank you all for your help.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.