Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
This is my database
Product | Status |
---|---|
Notebook | Broken |
Notebook | Broken |
Notebook | Broken |
Notebook | Stolen |
Notebook | Borrowed |
Cellphone | Broken |
Cellphone | Broken |
Cellphone | Broken |
Cellphone | Sold |
Cellphone | In used |
I want QV to return in a Textbox
Broken Products = 6
Not Broken Products = 4
I used this as expression
if(Status='Broken', count(Product))
if(Status=<>'Broken', count(Product))
Unfortunetely it is not working. Is there a solution with if expression and set analysis?
I agree and if you need the set expression to be filtered based on selection in Status field. You can try these expressions:
1) Count({<Status *= {'Broken'}>}Product)
2) Count({<Status -= {'Broken'}>}Product)
My Set Analysis skills are not that good. But I'm still learning it. Thank you for your advices. I see my mistake with the if expression. I didnt expect that i have to use the count espression first and then the if expression. Thank you very much guys!
Basic set analysis is very easy and efficient way to restrict things. Lets go over the few expressions that I and others have used above.
1) Count({<Status = {'Broken'}>}Product)
Regardless of selection in Status, always show count of product where status = Broken.
2) Count({<Status *= {'Broken'}>}Product) -> Equailant of Count(If(Status = 'Broken', Product))
Show count of product where status is equal to Broken. But this is going to filter out any broken status if they are not part of the selection. So for instance if you select Sold in your example above, you will see 0 instead of 6.
3) Count({<Status ={'*'} - {'Broken'}>}Product)
Regardless of selection in status, always show couunt of products where status is not equal to broken
4) Count({<Status -= {'Broken'}>}Product) -> Equailant of Count(If(Status <> 'Broken', Product))
Show count of product where status is not equal to Broken. But this is going to filter out any non-broken status if they are not part of the selection. So for instance if you select Sold in your example above, you will see 1 instead of 4. If you select Broken, you will see 0.
I hope this will help clarify some of your set analysis doubts. For more information read the attached document. The document isn't perfect, but can help you learn a lot of things.