Expression Builder

sangaran
edited February 11, 2022 in Analytics #1
Hi

I am new to birt.

I have built the query in the report designer

select * from users where user_name = ?

I have added report parameter to filter which will be from user. Now I have one issue. If the user selects ALL i should skip the where clause.

How can i do that

Thanks in advance

Comments

  • cypherdj
    edited December 31, 1969 #2
    Sangaran,

    I'm guessing you have also created a query parameter which uses the value from your report parameter.

    Instead, you can define your query as:
    selects * from users

    You will then need to apply 2 filters:
    1. to test if the parameter value was entered.
    apply a query filter (edit data set -> filters, click new)
    from expression, click Fx, in category, select Report Parameters, in sub-category, select All, then double click your parameter to paste it into the expression builder, then click ok
    from operator, select not equal to
    from value1, enter ALL (or the underlying value matching ALL)

    2. to test if the parameter value matches user_name.
    apply a query filter (edit data set -> filters, click new)
    from expression, select user_name
    from operator, select equal to
    from value1, select build expression, in category, select Report Parameters, in sub-category, select All, then double-click your parameter to paste it into the expression builder, then click ok

    Let me know if that doesn't work,
    Regards,
    Cedric
  • sangaran
    edited December 31, 1969 #3
    Hi Cedric

    Thanks for your reply. I got the solution and worked in other way around. I have used Property binding mechanism which uses script to give dynamic query based on the input parameter