25
Views
9
Comments
Solved
How to not filter in aggregate if else
Question

How to set if there are value in CategoryInput, it will filter, if not it will not filter( mean that it just display all from the aggregate).

Solution

You should not use an If statement in a filter but rather a so called Conditional SQL Statement that would like

CategoryInput = NullIdentifier() OR Product.CategoryId = CategoryInput

This returns all records when CategoryInput is a NullIdentifier. If CategoryInput has a value it returns only records where CategoryId of the Product entity is equal to the Input parameter CategoryInput.

Best

Stefan

Hi,

if(CategoryInput <> nullidentifier(),product.categoryId= categoryInput, true)

Use true, it will work.

what im doing wrong, it still say no records

Hi Irfan,
In your existing false condition, you can simply pass True,

Please let me know if you have more queries.

Regards,
Anubhav

what im doing wrong, it still say no records

This warning is showing because you must have compared 2 different data types, please check the data type of CatagoryInput and Product.CatagoryId) both should have the same data type.
Please check the test values you need to pass the nullidentifier() in the catagory input then only it will show all the data.

thanks. i got it. i replace the nullidentifier with 0 instead and it work. idk why lol.

can you show the sources and join condition. else share the oml,

Solution

You should not use an If statement in a filter but rather a so called Conditional SQL Statement that would like

CategoryInput = NullIdentifier() OR Product.CategoryId = CategoryInput

This returns all records when CategoryInput is a NullIdentifier. If CategoryInput has a value it returns only records where CategoryId of the Product entity is equal to the Input parameter CategoryInput.

Best

Stefan

Hi,

I have attached the oml for your reference .customize it as Category.Id= NullIdentifier() OR Product.CategoryId = CategoryInput .

Hope this helps you.


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