Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
deepanshuSh
Creator III
Creator III

If and else condition Not working without the filter.

So to put it in a simple way, there is an if and else condition that is based on 3 fields and three tags associated to it. The app and logic was working before, the code is shown as below. 

The logic works fine when you have selected the filter (i.e Registration Number =0), otherwise it shows 0 value. I am not able to understand why its not working anymore and how to resolve it. 

 

 

Num((Count((If(MY_AUDI_Vehicle_VIN=VIN,
(if(registrationNumber_tag=0,registrationNumber,
if([Reg. No._tag]=0, [Reg. No.]))),
If(DMS_VIN=VIN,(if(registrationNumber_tag=0,registrationNumber,
if([Reg. No._tag]=0, [Reg. No.]))))
))
))

Trial and error is the key to get unexpected results.
Labels (1)
1 Solution

Accepted Solutions
rubenmarin

Hi, if an expression (or field) has more than one possible value it returns null, so maybe registrationNumber_tag=0 or [Reg. No._tag]=0 can only be evaluated when there is a selection that reduces the multiple values of those fields to a single value that can be evaluated.

You can check this adding a text box for each field with the expression =registrationNumber_tag or =[Reg. No._tag] and check how it changes with selections.

Without knowing the intention of your expression or the model behind I think the option here is to enclose in an aggr that evaluates the different combinations of values, like:

Num(Sum(Aggr((Count((If(MY_AUDI_Vehicle_VIN=VIN,
(if(registrationNumber_tag=0,registrationNumber,
if([Reg. No._tag]=0, [Reg. No.]))),
If(DMS_VIN=VIN,(if(registrationNumber_tag=0,registrationNumber,
if([Reg. No._tag]=0, [Reg. No.]))))
))
),MY_AUDI_Vehicle_VIN,registrationNumber_tag,[Reg. No._tag]))
)

View solution in original post

2 Replies
rubenmarin

Hi, if an expression (or field) has more than one possible value it returns null, so maybe registrationNumber_tag=0 or [Reg. No._tag]=0 can only be evaluated when there is a selection that reduces the multiple values of those fields to a single value that can be evaluated.

You can check this adding a text box for each field with the expression =registrationNumber_tag or =[Reg. No._tag] and check how it changes with selections.

Without knowing the intention of your expression or the model behind I think the option here is to enclose in an aggr that evaluates the different combinations of values, like:

Num(Sum(Aggr((Count((If(MY_AUDI_Vehicle_VIN=VIN,
(if(registrationNumber_tag=0,registrationNumber,
if([Reg. No._tag]=0, [Reg. No.]))),
If(DMS_VIN=VIN,(if(registrationNumber_tag=0,registrationNumber,
if([Reg. No._tag]=0, [Reg. No.]))))
))
),MY_AUDI_Vehicle_VIN,registrationNumber_tag,[Reg. No._tag]))
)

deepanshuSh
Creator III
Creator III
Author

Thanku Ruben, I got the issue, it was from the  data's end and I tried it using the aggr function it kind of worked but made the dashboard heavier, I resolved it from the backend only. To reduce the data load. 

Trial and error is the key to get unexpected results.