Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I am trying to manage to get my IF to work .. The problem is, that it does not really sum my sum() values in table 😕
If I use text-box object and the sum() values without if, then it sum() the values correctly without any problem . But even if I put the IF to text-box, it returns 0.
I am using the code below, I made some changes on the names...
If there is anyone who can help me with this, it would be much appreciated! !
=
// IF USER HAS NOT MADE ANY SELECTIONS OR SELECTED ALL OF THE 3
if(Count(distinct SourceName)=3,
// IF THERE IS NOT ANY SELECTIONS, WE WILL SUM THE A,B AND C WITH FILTERS
(sum({$<SourceName ={'*'} - {'C'}>} VALUE)) + (sum({<[FILTER1]={'BANANA'}, [FILTER2] = {">$(=-100)<$(=100)"}, SourceName={'C'}>} VALUE))
,
// IF ONE SOURCE HAS BEEN SELECTED AND IT IS C
if(Count(distinct SourceName)=1, if(WildMatch(lower(GetFieldSelections(SourceName)),'*c*'),
// IF IT IS 1 AND IT IS C
(sum({<[FILTER1]={'BANANA'}, [FILTER2] = {">$(=-100)<$(=100)"}, SourceName={'C'}>} VALUE)),
// IF IT IS 1 AND IT IS NOT C
(sum(VALUE))),
// IF THE SELECTION IS DIFFERENT THAN 3 OR 1 (IN THIS CASE 2)
// IF THE C IS WITHIN SELECTIONS
if(WildMatch(lower(GetFieldSelections(SourceName)),'*c*'),
// IF THE SELECTIONS INCLUDE ALSO A
if(WildMatch(lower(GetFieldSelections(SourceName)),'*a*'),
(sum({<SourceName = {'A'}>} VALUE))
+ (sum({<[FILTER1]={'BANANA'}, [FILTER2] = {">$(=-100)<$(=100)"}, SourceName={'C'}>} VALUE))
,
// IF THE OTHER SELECTION INCLUDES B
if(WildMatch(lower(GetFieldSelections(SourceName)),'*b*'),
(sum({$<SourceName = {'B'}>} VALUE)) + (sum({<[FILTER1]={'BANANA'}, [FILTER2] = {">$(=-100)<$(=100)"}, SourceName={'C'}>} VALUE)))),
// IF THE C IS NOT INCLUDED IN THE SELECTIONS
(sum(VALUE))
)))
The red part of the code is the one that does not work correctly on my table .. Actually it does the sum() values right on text-box for some reason.
Cheers,
Niko
Please put on red color which expression is getting the problem..
Yeah, I was going to do that .. !
You are using lower function but highlighting character in UPPER
if(WildMatch(lower(GetFieldSelections(SourceName)),'*a*'),
(sum({<SourceName = {'A'}>} VALUE))
+ (sum({<[FILTER1]={'BANANA'}, [FILTER2] = {">$(=-100)<$(=100)"}, SourceName={'C'}>} VALUE))
,
// IF THE OTHER SELECTION INCLUDES B
if(WildMatch(lower(GetFieldSelections(SourceName)),'*b*'),
(sum({$<SourceName = {'B'}>} VALUE)) + (sum({<[FILTER1]={'BANANA'}, [FILTER2] = {">$(=-100)<$(=100)"}, SourceName={'C'}>} VALUE))))
Note: check parenthesis as well
Hello,
a very good guess! That was just my mistake when I replaced the actual sourcenames.. They are at lowercase on my code. Good guess tho!
Cheers,
Niko
Niko,
Please confirm me, one thing..
Are you filtering A & B from Source name is after selection / Before Selection / Current Selection ?
If Current Selection you should maintain $ for Current Selection in the Expression..
The if-condition should be working after selections, or that I am trying to achieve.
Where you mean I should use the $ then?
Cheers,
Niko
Niko,
Please find below.. Or else please share me sample Application ....
Updated:
if(WildMatch(lower(GetFieldSelections(SourceName)),'*B*'), (sum({$<SourceName = {'B'}>} VALUE)) + (sum({<[FILTER1]={'BANANA'}, [FILTER2] = {">$(=-100)<$(=100)"}, SourceName={'C'}>} VALUE)))
if(WildMatch(lower(GetFieldSelections(SourceName)),'*A*'), (sum({$<SourceName = {'A'}>} VALUE)) + (sum({<[FILTER1]={'BANANA'}, [FILTER2] = {">$(=-100)<$(=100)"}, SourceName={'C'}>} VALUE)))
Hi Niko, I don't see why isn't working. Wildmatch isn't case sensitive but set analysis is case sensitive, it leads to think about something with case in set analysis but if that was the case, the first part of the 'If' wouldn't work either.
To check it it's an 'If' or a 'sum' issue you can try changing each if to return a different number (a simple '1', '2', etc...) to check if the 'if' is going to the expected sentence.
I have tried something like that already to see what part of my IF-clause does not work.. Just outputting different strings of the steps and they seem to work.
Actually now when I tested with numbers, the last two steps that are highlighted with red.. Does not work the way I want them to work.
If I put number 1 to the if(WildMatch(lower(GetFieldSelections(SourceName)),'*a*'),
and number 2 to the if(WildMatch(lower(GetFieldSelections(SourceName)),'*b*'),
They return the values to the table when I select the opposite value?
Cheers,
Niko