cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper III
Helper III

Filter Entire Gallery Based on a field

Dear All, I am trying to filter a gallery based on a lookup field.

 

Lookup field contains plant code. My objective is users should see the entries belonging to their plant. Users should not see other plants records. I tried to write below formula but did not work. Can i ask you support on this?

 

2020-05-12 15_52_22-Transport Order Creation Tool - Saved (Unpublished) - Power Apps.png2020-05-12 15_56_09-Transport Order Creation Tool - Saved (Unpublished) - Power Apps.png

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User II
Super User II

Hi @Ogun_ustun 

Your formula for filtering is incorrect.  You failed to identify the Field in the datasource that is equal to DataCardValue2_1.Text.  If the column in your datasource is PlantSAPcode then the formula should be something like

 

 

Sort( Filter(TransferOrderNumberApplication,PlantSAPCode=DataCardValue2_1.Text), 'Order Date', Descending)

 

 

Also, there is no need to have two separate formulas for sorting and filtering.  PowerApps executes functions from the inside out.  In this case, the datasource will be filtered first and then sorted.  

View solution in original post

Community Support
Community Support

Hi@Ogun_ustun,

 

Based on the issue you mentioned, you want to filter the specified entries.

 

  • Could you please share more about your data source? Is it a SP List?
  • Could you please share more about your Plant SAP Code column type, is it a LookUp field?
  • DataCardValue2_1 is the corresponding control of the Plant SAP Code?

 

It seems that something is wrong with your formula. ‘TransferOrderNumberApplication’ is your data source name, and DataCardValue2_1 is a control in your app which can’t be referred to in your data source. What‘s more, you should refer to your corresponding column in your data source.

 

Please try to modify your formula like this:

Sort (Filter(TransferOrderNumberApplication,'Plant SAP Code '.Value="MA11"),OrderDate,Descending)

Replace the “MA11” with Plant  SAP Code value within your Detail form. You may need to use the following formula to reference the Plant  SAP Code value:

DataCardValue2_1.Selected.Value

 

Note

  • 'Plant SAP Code ' is a column contains plant code in your data source. I assume your data source is a SP list.
  • The screenshot you provided display MA11, I assume you want to filter the users in this plant.

 

Best Regards,

Qi Qiao

View solution in original post

2 REPLIES 2
Super User II
Super User II

Hi @Ogun_ustun 

Your formula for filtering is incorrect.  You failed to identify the Field in the datasource that is equal to DataCardValue2_1.Text.  If the column in your datasource is PlantSAPcode then the formula should be something like

 

 

Sort( Filter(TransferOrderNumberApplication,PlantSAPCode=DataCardValue2_1.Text), 'Order Date', Descending)

 

 

Also, there is no need to have two separate formulas for sorting and filtering.  PowerApps executes functions from the inside out.  In this case, the datasource will be filtered first and then sorted.  

View solution in original post

Community Support
Community Support

Hi@Ogun_ustun,

 

Based on the issue you mentioned, you want to filter the specified entries.

 

  • Could you please share more about your data source? Is it a SP List?
  • Could you please share more about your Plant SAP Code column type, is it a LookUp field?
  • DataCardValue2_1 is the corresponding control of the Plant SAP Code?

 

It seems that something is wrong with your formula. ‘TransferOrderNumberApplication’ is your data source name, and DataCardValue2_1 is a control in your app which can’t be referred to in your data source. What‘s more, you should refer to your corresponding column in your data source.

 

Please try to modify your formula like this:

Sort (Filter(TransferOrderNumberApplication,'Plant SAP Code '.Value="MA11"),OrderDate,Descending)

Replace the “MA11” with Plant  SAP Code value within your Detail form. You may need to use the following formula to reference the Plant  SAP Code value:

DataCardValue2_1.Selected.Value

 

Note

  • 'Plant SAP Code ' is a column contains plant code in your data source. I assume your data source is a SP list.
  • The screenshot you provided display MA11, I assume you want to filter the users in this plant.

 

Best Regards,

Qi Qiao

View solution in original post

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (22,713)