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

Filter gallery items on 2 variables

I'm not sure if this is possible. But looking for help on Filtering a gallery on 2 variables. I've created a gallery with a excel feel. I can navigate and update records fine on the next gallery with no problems. The issue is trying to create a new record and displaying a default patch record in the next screen(gallery)? My gallery Items are set to sort(Filter(Datasource, ID=varible1), Ascending). 

 

Global Varible 1 is an item Onselect from screen1 moving to an editable excel like experience in screen 2. Ideally I would like to onselect of a + patch a default record, then navigate to the next gallery. If that makes sense?

6 REPLIES 6
StalinPonnusamy
Community Champion
Community Champion

Hi @MP_Squared 

 

We can use just the gallery itself like an excel and keep adding rows and Patch all together or only the changed items

  • Onvisible of the screen ClearCollect(ColName, SPList)
  • Set Items property of Gallery to ColName
  • Insert 2 icons (Add/Plus and Save)
  • Set Add cion Onselect property to Collect(ColData,{})
  • Set OnSelect property of Save icon to 

 

ClearCollect(
    TempCollection,
    RenameColumns(
        BrowseGallerySave.AllItems,
        "ID",
        "newID"
    )
);
ForAll(
    TempCollection,
    Patch(
        SPList,
        LookUp(
            SPList,
            ID = newID
        ),
        {Title: TextInput1.Text}
    )
)

 

 

Example:

StalinPonnusamy_0-1631564472800.png

 

 

 

WarrenBelz
Super User
Super User

Hi @MP_Squared ,

When you patch the new record, you need to set the ID to the Variable

Set(
   variable1,
   Patch(
      datasource,
       . . . .. 
   ).ID
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Thanks for the fast response WarrenBelz, I get the below trying the formula. Also this the 2second screenshot is the onselect for navigating an existing item to the next gallery. Thanks for the help! 

 

2021-09-13_17-04-10.png

screenshot2screenshot2

@MP_Squared ,

Can you please post your code in Text - change the reference names if you must, but I cannot get much out of blurred out small images.

@WarrenBelz , Sure no problem. The datasource is a sql database. The onselect property on the + is set to Set(varProduct, Patch('datasource', Defaults('datasource'), {PRODUCT_ID: "data"}); Navigate(GPL_Details, None, {SelectedItem: LookUp('Datasource', PRODUCT_ID = ThisRecord)})

I'm stuck on navigating to the newly created record on gallery2 once its as well. 

Onselect property for an existing record and navigating to gallery2 works fine. It is Select(Parent); Set(varProduct, Gallery2_1.Selected.PRODUCT_ID); Navigate(Details, Transition.None, {SelectedItem: LookUp('Datasource', PRODUCT_ID = varProduct)});

 

Gallery2 Items are currently set to

Sort(Filter('Datasource', PRODUCT_ID = varProduct), PRODUCT_PLATFORM, Ascending)

 

 

Hi @MP_Squared ,

I tend to do it this way - assuming PRODUCT_ID is a unique identifier

Set(
   varProduct, 
   Patch(
      'datasource', 
      Defaults('datasource'), 
      {PRODUCT_ID: "data"}
   ).PRODUCT_ID
); 
Navigate(
   GPL_Details, 
   None, 
   {
      SelectedItem: 
      LookUp(
         'Datasource', 
         PRODUCT_ID = varProduct
      )
   }
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,806)