Here’s a detailed exploration of the “in” operator in Power Apps, which I recently researched thoroughly.
The “in” Operator
In Power Fx, the “in” operator is used to check whether a specified value exists within a text string or a collection (such as an array or table). The expression always returns either true or false.
Let’s dive into how to use it.
Basic Usage of the “in” Operator
As mentioned earlier, the “in” operator can be used with “text strings,” “arrays,” and “tables.”
Text Strings
When used with text strings, the “in” operator performs partial string matching.


"pow" in "Power Apps" // true "wop" in "Power Apps" // false "" in "Power Apps" // true // Note: An empty string is considered to be contained within all strings.
Arrays




"aaa" in ["aaa", "bbb", "ccc"] // true "AAA" in ["aaa", "bbb", "ccc"] // true "a" in ["aaa", "bbb", "ccc"] // false {Value:"aaa"} in ["aaa", "bbb", "ccc"] // true
Table (Including Collection)

ClearCollect( colSample, {text:"aaa", num:0}, {text:"bbb", num:1}, {text:"ccc", num:2} )



"aaa" in colSample // Error {text:"aaa"} in colSample // Error {text:"aaa", num:0} in colSample // true {text:"AAA", num:0} in colSample // false {text:"aaa", num:1} in colSample // false {} in colSample // false
Differences Between “in” and “exactin”
The key difference between “in” and “exactin” is whether they are case-sensitive.

"pow" in "Power Apps" // true "pow" exactin "Power Apps" // false "Pow" exactin "Power Apps" // true "" exactin "Power Apps" // true

"AAA" in ["aaa", "bbb", "ccc"] // true "AAA" exactin ["aaa", "bbb", "ccc"] // false
Using with Filter Function
Since the “in” operator is frequently used with the Filter function, let’s explore how they work together.

ClearCollect( colSample, {text1:"aaa", text2:"xxx", num:0}, {text1:"abc", text2:"xyz",num:1}, {text1:"bbb", text2:"yyy",num:1}, {text1:"bca", text2:"yzx",num:2}, {text1:"ccc", text2:"zzz",num:3} )





About Delegation
Finally, let’s discuss delegation. The ability to delegate depends on the data source.
SharePoint

Dataverse



コメント