cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Refer to a Filter result in a formula

Hello,

I am currently trying to make an 'Inventory App' for my company.
I use a SP List. I implemented an option to book a certain Item, but now I am looking for a way to kind of put the Item back into storage.
When booking an item I let the App create a new Entry with the same name and the desired amount, which gets substracted from the original one.
The 'back into storage' function so far looks like this:

Patch(
Inventar;
First(
Filter(
Inventar;
Title = InventarGalerie.Selected.Title && ID < InventarGalerie.Selected.ID
)
);
{Anzahl: + InventarGalerie.Selected.Anzahl}
)

For reference: Anzahl = Amount, Inventar = SP List, InventarGalerie = Galery that displays the list

The first part seems to work fine, but I have no idea how i can refer to the filter results in my formula.
I think i need something like {Anzahl: FilterResult + InventarGalerie.Selected.Anzahl} .


Any help will be apreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Refer to a Filter result in a formula

Hi @dkey ,

Could you please share a bit more about your scenario?

Do you want to reference the Filtered result from the Filter formula within your Patch function?

 

If you want to reference the Filtered result from the Filter formula within your Patch function, I have made a test on my side, please consider modify your formula as below:

Patch(
     Inventar;
     First(
            Filter(
                   Inventar;
                   Title = InventarGalerie.Selected.Title && ID < InventarGalerie.Selected.ID
                  )
     );
     {           /* <-- Modify your formula below */
Anzahl: First(Filter(Inventar; Title = InventarGalerie.Selected.Title && ID < InventarGalerie.Selected.ID)).Anzahl + InventarGalerie.Selected.Anzahl
} )

Please take a try with above solution, check if the issue is solved.

 

More details about Filter function in PowerApps, please check the following aeticle:

Filter function

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Highlighted
Super User III
Super User III

Re: Refer to a Filter result in a formula

Hi @dkey 

Unless I misunderstand you, you'd like to refer to the record that you've just updated with Patch.

If that's the case, it's worth noting that the return value from Patch contains the updated record.

For example if you use the following formula, you can use LastUpdatedRecord to refer to the record that you updated.

 

Set(LastUpdatedRecord;
Patch(Inventar; First( Filter( Inventar; Title = InventarGalerie.Selected.Title && ID < InventarGalerie.Selected.ID ) ); {Anzahl: + InventarGalerie.Selected.Anzahl} )
)

 

 

 

Highlighted
Community Support
Community Support

Re: Refer to a Filter result in a formula

Hi @dkey ,

Could you please share a bit more about your scenario?

Do you want to reference the Filtered result from the Filter formula within your Patch function?

 

If you want to reference the Filtered result from the Filter formula within your Patch function, I have made a test on my side, please consider modify your formula as below:

Patch(
     Inventar;
     First(
            Filter(
                   Inventar;
                   Title = InventarGalerie.Selected.Title && ID < InventarGalerie.Selected.ID
                  )
     );
     {           /* <-- Modify your formula below */
Anzahl: First(Filter(Inventar; Title = InventarGalerie.Selected.Title && ID < InventarGalerie.Selected.ID)).Anzahl + InventarGalerie.Selected.Anzahl
} )

Please take a try with above solution, check if the issue is solved.

 

More details about Filter function in PowerApps, please check the following aeticle:

Filter function

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Regular Visitor

Re: Refer to a Filter result in a formula

@v-xida-msftThank you for the quick response, the solution you provided works!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (9,769)