I know this is simple, but...
The below 'exactin' (or just 'in') statement works fine for checking whether the collection 'Col_GraphElement' contains a selected number within its ID_Number column.
RemoveIf(Col_GraphElement,ID_Number exactin Col_GraphElement.ID_Number)
But if I replace 'exactin' with =, I get 'invalid argument type.
This doesn't seem to make sense. How else can I check if the ID exactly matches an existing record in the collection?
Thanks.
Hi @Anonymous ,
The reason why you should use 'exactin' (or 'in') in the first formula is that:
Col_GraphElement.ID_Number represents a table, while ID_Number is a value.
You can not compare a value with a table.
You could only check whether a value is inside the table.
If you want to find the exactly record, you could try the formula:
LookUp(Col_GraphElement,ID_Number=selected.ID_Number)
ID_Number represent a field name inside Col_GraphElement table.
You could check whether a filed is equal to a value.
selected.ID_Number represent the selected number , you should replace it with a value.
Please note that when comparing you should use these two types
1)value in table
2)field name=value
Bets regards,
Ok thanks-that makes sense as far as a single value is concerned 🙂 The LookUp() function is ideal for this!
But what if multiple matches might be found?
Eg:
Col_Fruit contains a column called Fruit_Name. Fruit_Name contains the following values:
"Orange"
"Apple"
"Apple"
"Apples"
"Pear"
Suppose I want to delete all 'Apple' entries.
I cannot use the following:
RemoveIf(Col_Fruit,"Apple" in Col_Fruit.Fruit_Name)
This would remove "Apples" as well as the "Apple" entries.
I cannot not use 'LookUp' here (as far as I can tell) since multiple records need to be removed.
I think that you explained a solution to this with the following. I just need to understand 2) a bit better.
<blockquote>
Please note that when comparing you should use these two types
1)value in table
2)field name=value
</blockquote>
I think I understand 1). "Apple" in Col_Fruit.Fruit_Name would be an example of this.
But I'm not sure I understand 2). Sorry if this sounds obvious, but how do I identify the field name in PowerApps? (Assuming field_name isn't a reserved keyword, of course)
Using the above example, the field name is whatever is contained for each record. So the field name of "Apple" is "Apple", etc...so the relevant syntax for 'field name = value' would be... "Apple" = "Apple"?
I think I just need some help clarifying this second point (point 2) but otherwise, thanks for the help so far.
Check out new user group experience and if you are a leader please create your group
Did you miss the call?? Check out the Power Apps Community Call here!
See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.
User | Count |
---|---|
278 | |
235 | |
83 | |
37 | |
36 |
User | Count |
---|---|
358 | |
239 | |
127 | |
72 | |
50 |