I have a gallery and several filters, searches and all is working fine, however I want to put the records into a collection and I cannot for the life of me figure out how to put the results of the IF statement into a collection. Everything I try gives me an error. If I try to wrap the Filter statement in a Clear Collect, I get this error:
Basically I want to create a collection and be able to assign whatever the results of this IF statement are to the collection so that I can reference the collection elsewhere. Any ideas as to where I am going wrong?
Here is the If statement that is on the galARSTRecords.This:
If(ddSearchBy.Selected.Value = "Check Number" And ddFilter.Selected.Result = "All",
Filter('ARST Check Manager',StartsWith('Check Number',txtSearch.Text)),
ddSearchBy.Selected.Value = "Student ID" And ddFilter.Selected.Result = "All",
Filter('ARST Check Manager',StartsWith(Vendor,txtSearch.Text)),
ddSearchBy.Selected.Value = "Last Name" And ddFilter.Selected.Result = "All",
Filter('ARST Check Manager',StartsWith('Last Name',txtSearch.Text)),
ddSearchBy.Selected.Value = "Check Number" And ddFilter.Selected.Result <> "All" And optFilter.Selected.Value = "Status",
Sort(Filter('ARST Check Manager',Action.Value = ddFilter.Selected.Result And StartsWith('Check Number',txtSearch.Text)),'Action Date',Descending),
ddSearchBy.Selected.Value = "Student ID" And ddFilter.Selected.Result <> "All" And optFilter.Selected.Value = "Status",
Filter('ARST Check Manager',Action.Value = ddFilter.Selected.Result And StartsWith(Vendor,txtSearch.Text)),
ddSearchBy.Selected.Value = "Last Name" And ddFilter.Selected.Result <> "All" And optFilter.Selected.Value = "Status",
Filter('ARST Check Manager',Action.Value = ddFilter.Selected.Result And StartsWith('Last Name',txtSearch.Text)),
ddSearchBy.Selected.Value = "Check Number" And ddFilter.Selected.Result <> "All" And optFilter.Selected.Value = "Term",
Filter('ARST Check Manager',Term = ddFilter.Selected.Result And StartsWith('Check Number',txtSearch.Text)),
ddSearchBy.Selected.Value = "Student ID" And ddFilter.Selected.Result <> "All" And optFilter.Selected.Value = "Term",
Filter('ARST Check Manager',Term = ddFilter.Selected.Result And StartsWith(Vendor,txtSearch.Text)),
ddSearchBy.Selected.Value = "Last Name" And ddFilter.Selected.Result <> "All" And optFilter.Selected.Value = "Term",
Filter('ARST Check Manager',Term = ddFilter.Selected.Result And StartsWith('Last Name',txtSearch.Text)),
ddSearchBy.Selected.Value = "Check Number" And ddFilter.Selected.Result <> "All" And optFilter.Selected.Value = "Type",
Filter('ARST Check Manager','AR Type'= ddFilter.Selected.Result And StartsWith('Check Number',txtSearch.Text)),
ddSearchBy.Selected.Value = "Student ID" And ddFilter.Selected.Result <> "All" And optFilter.Selected.Value = "Type",
Filter('ARST Check Manager','AR Type' = ddFilter.Selected.Result And StartsWith(Vendor,txtSearch.Text)),
ddSearchBy.Selected.Value = "Last Name" And ddFilter.Selected.Result <> "All" And optFilter.Selected.Value = "Type",
Filter('ARST Check Manager','AR Type' = ddFilter.Selected.Result And StartsWith('Last Name',txtSearch.Text)),
'ARST Check Manager')
Solved! Go to Solution.
Hi @BarnBrat ,
The error message is because you used the behavior function on the wrong control property.
ClearCollect() funcion is a behavior function. It can only be triggered after a event is executed.
For example: When you click on a button and trigger an event, the clearcollect function will be executed.
So you could use ClearCollect() function on the Onselect property of button control.
In addition, there are many such properties, e.g. Onchange , OnVisible,...
Best Regards,
Wearsky
Actually if you use the formula in Items property of the Gallery, the results of the formula can be use as a collection with galARSTRecords.AllItems.
Hope it helps !
I hear what you are saying, and that is what I want to do, but it's the how that I cannot figure out...
I think I am catching on. After I figure out how to initially load all of the records into the collection, I'll post what I've done 🙂
Hi @BarnBrat ,
The error message is because you used the behavior function on the wrong control property.
ClearCollect() funcion is a behavior function. It can only be triggered after a event is executed.
For example: When you click on a button and trigger an event, the clearcollect function will be executed.
So you could use ClearCollect() function on the Onselect property of button control.
In addition, there are many such properties, e.g. Onchange , OnVisible,...
Best Regards,
Wearsky
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
259 | |
126 | |
86 | |
85 | |
68 |