Hello Folks, hope someone can give me a light on this since I'm struggling to find the answer for the past few days...
I can't find a solution to filter my gallery. I need to fulfill two condition, but I always end up comparing a TEXT to a TABLE. Is there anyway to use the IF formula to compare my logical statement row by row? I need to Filter my gallery accordingly to the Approver, so If someone makes a New Request, Approver 1 would see it, but Approver 2 not. Once Approver 1 approved, he wouldn't be able to reach out the record anymore and Approver 2 would be able to see it.
The following formula Filter(BaseAppRH;And('Status Aprov. 1' = "Analysing"; User().Email = 'Aprov 1.') worked for what I'm trying to achieve, but I need to insert a IF before it, in case Approver 2 is online, which would translate to the following Filter(BaseAppRH;And('Status Aprov. 2' = "Analysing"; User().Email = 'Aprov 2.')
In the end of the day, I need something like If(User().Email = Approver 1; First Aforementioned Example; Second Aforementioned Example), but as of now, the only way I've found to achieve this is swapping the column Approver 1 to "MyEmail@PowerApps.com", which is not ideal because if I need to change the approvers, I'd need to change the formula and not the table it refers to.
Thanks in advance to anyone!
Solved! Go to Solution.
Avoid using If's in your formulas with filters.
Please consider changing your Formula to the following:
Filter(BaseAppRH;
('Status Aprov. 1' = "Analysing" && StartsWith('Aprov 1.'; User().Email)) ||
('Status Aprov. 2' = "Analysing" && StartsWith('Aprov 2.'; User().Email))
)
I'm not completely clear on your logic that you are trying to achieve, but the above is what I am getting from your logic.
I hope this is helpful for you.
Avoid using If's in your formulas with filters.
Please consider changing your Formula to the following:
Filter(BaseAppRH;
('Status Aprov. 1' = "Analysing" && StartsWith('Aprov 1.'; User().Email)) ||
('Status Aprov. 2' = "Analysing" && StartsWith('Aprov 2.'; User().Email))
)
I'm not completely clear on your logic that you are trying to achieve, but the above is what I am getting from your logic.
I hope this is helpful for you.
Sadly it didn't work. I couldn't return any records, even when using only one line (don't even know why, since it seems to be correct).
What I really want is that each user only sees the approvals that are under them, in other words, if Approver 1 already Approved ID 1, he won't be able to reach out the record anymore and it would only be visible to Approver 2.
When using Filter(BaseAppRH;'Status Aprov. 1' = "Em Análise" && User().Email = 'Aprov 1.') I get 2 records.
I tried using your Filter(BaseAppRH;('Status Aprov. 1' = "Analysing" && StartsWith('Aprov 1.'; User().Email))) but it brought 0 records... Below my sharepoint table.
Also, when using 'Aprov. 1' = User().Email on a Text INput, I get true. Which makes very confusing as of why it isn't working
Filter(BaseAppRH;
('Status Aprov. 1' = "Analysing" && 'Aprov 1.' = User().Email) ||
('Status Aprov. 2' = "Analysing" && 'Aprov 2.' = User().Email)
)
I swapped the StartWith for " = " and it worked! Thanks!
That will work, just be cautious with using the equal "=" on emails...many times the letter case is different - someone@company.com is the same email as Someone@company.com but the equal operator will NOT see them as equal because of the letter case. The StartsWith is the trick to avoid that issue because it is not case sensitive.
"someone@company.com" = "Someone@company.com" is false
StartsWith("someone@company.com", "Someone@company.com") is true
Glad you have it working now.
User | Count |
---|---|
159 | |
97 | |
82 | |
75 | |
59 |
User | Count |
---|---|
195 | |
176 | |
103 | |
94 | |
86 |