web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Error Occurs When Atte...
Power Apps
Unanswered

Error Occurs When Attempting to Edit Gallery Code and Reset Search

(0) ShareShare
ReportReport
Posted on by

Hello Everyone,

 

I'm having a few errors occur with my app and would like to know if anyone can help me troubleshoot this.

 

I have an app with a pop-up gallery that uses a search text input and two dropdowns to search for records in SharePoint.  The search works as it's currently coded and is set up to search for all words with spaces in between them for up to 5 words and the dropdowns filter the results just fine.  I have two issues that I need to solve though:

 

1) I set up a reset button to reset the search text input, and both dropdowns.  After a search is performed and a record is selected, if I go back and hit reset, those records will no longer appear in the search.  How can I correct this?

 

Screen - On Visible - 

ClearCollect(CollectOwners, {Result: "Filter by Owner"});

ClearCollect(CollectParents, {Result: "Filter by Parent"});

Collect(CollectOwners, Sort(Distinct(SharePointList1, Owner),Result));

Collect(CollectParents, Sort(Distinct(SharePointList1, Parent),Result));

 

DropDown1 - Items -

CollectOwners

 

Dropdown2 - Items -

CollectParents

 

Reset Button - OnSelect -

Reset('Search-OwnerDropDown');Reset('Search-ParentDropDown');Reset('Search-SearchTextInput_1');

 

Next Arrow - OnSelect -

Set(VarRecord, ThisItem); Set(_popupwindow,false);

 

 

SearchGallery - Items -

SortByColumns(

 Search(

 Search(

 Search(

 Search(

 Search(

 If(//all and all

 'Search-OwnerDropDown'.Selected.Result = "Filter by Owner" And 'Search-ParentDropDown'.Selected.Result = "Filter by Parent",

 SharePointList1,

 //all Owners and filtered Parents

 'Search-OwnerDropDown'.Selected.Result = "Filter by Owner" And 'Search-ParentDropDown'.Selected.Result <> "Filter by Parent",

 Filter(

 SharePointList1,

 Parent = 'Search-ParentDropDown'.Selected.Result

 ),

 //all Parents filtered Owners

 'Search-OwnerDropDown'.Selected.Result <> "Filter by Owner" And 'Search-ParentDropDown'.Selected.Result = "Filter by Parent",

 Filter(

 SharePointList1,

 Owner = 'Search-OwnerDropDown'.Selected.Result

 ),

 //Filtered Owners and PARENTs

 'Search-OwnerDropDown'.Selected.Result <> "Filter by Owner" And 'Search-ParentDropDown'.Selected.Result <> "Filter by Parent",

 Filter(

 SharePointList1,

 Owner = 'Search-OwnerDropDown'.Selected.Result And Parent = 'Search-ParentDropDown'.Selected.Result

 )

 ),

 Last(

 FirstN(

 TrimEnds(

 Split(

 'Search-SearchTextInput_1'.Text,

 " "

 )

 ),

 1

 )

 ).Result,

 "Owner",

 " Title",

 "Special_ID",

 "Country",

 "Parent"

 ),

 Last(

 FirstN(

 TrimEnds(

 Split(

 'Search-SearchTextInput_1'.Text,

 " "

 )

 ),

 2

 )

 ).Result,

 "Owner",

 " Title",

 "Special_ID",

 "Country",

 "Parent"

 ),

 Last(

 FirstN(

 TrimEnds(

 Split(

 'Search-SearchTextInput_1'.Text,

 " "

 )

 ),

 3

 )

 ).Result,

 "Owner",

 " Title",

 "Special_ID",

 "Country",

 "Parent"

 ),

 Last(

 FirstN(

 TrimEnds(

 Split(

 'Search-SearchTextInput_1'.Text,

 " "

 )

 ),

 4

 )

 ).Result,

 "Owner",

 " Title",

 "Special_ID",

 "Country",

 "Parent"

 ),

 Last(

 FirstN(

 TrimEnds(

 Split(

 'Search-SearchTextInput_1'.Text,

 " "

 )

 ),

 5

 )

 ).Result,

 "Owner",

 " Title",

 "Special_ID",

 "Country",

 "Parent"

 ),

 "Special_ID"

)

  

 


2) The bigger problem I have is, if I now go in to edit the code in Items from the Search Gallery, even if I just delete a comma or parenthesis and put it back, it causes almost all of the controls on my app to have an error and cannot be reverted back easily.  I currently have to perform a Cut of all the code in the gallery, save and exit the gallery, reload the app, and paste all the code back in for it to function again... Not the efficiency I was looking for. 

 

Some of the errors I'm getting appear to be the controls unable to find the VarRecord.'column' (Invalid use of '.') or (Invalid argument type.). And also, the search gallery Next Arrow used to select a record then gets an error red-line under VarRecord that says ('Incompatible type. We can't evaluate your formula because the context variable types are incompatible with the types of variables in other places in your app.')


Thanks in advance!

 

 

 

Categories:
I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard