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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / I need Help with the L...
Power Apps
Answered

I need Help with the LookUp Function

(0) ShareShare
ReportReport
Posted on by 5

01.png

I have an inventory system.
The square in YELLOW is where my problem is.
What's marked in GREEN are from the same database.
The variable "qtde" represents the quantity column of the database.

The variable "Arrqtde" represents the quantity that will be deducted from the stock.

My problem is here on the second qtde:     qtde: qtde - Value(Arrqtde)
The second qtde is supposed to be the live amount of items in the stock of that specific LookUp record (because is in a collect), but I don't know what I'm missing here.

I need that the second qtde to represent the live amount of items in the stock of that LookUp Record.


 

Categories:
  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Yakkek Do you mind posting the formula in the chat.

  • Verified answer
    Scott_Parker Profile Picture
    1,090 on at

    Note that I wrote this using the semicolon syntax based on your region, but I might have made mistakes since I normally use commas between function arguments.

     

    The second qtde is coming from arrPedido. That is because you are inside the scope of the ForAll function at that point, not the LookUp function. Lookup has already run and returned a record. If you wanted to use that record in multiple places, you could use a With() that sets the lookup to a locally scoped variable, e.g.:

     

     

     

    ForAll(
     arrPedido;
     With({xRecord: LookUp('public.bra_pa_cadastro_producto'; produto_referencia = Arreproducto_referencia)};
     Patch('public.bra_pa_cadastro_producto'; xRecord; {qtde: xRecord.qtde - Value(Arrqtde)});
     )
     )
    );;

     

     

     

     

    All that said, you can use an UpdateIf instead:

     

     

     

    UpdateIf(
     'public.bra_pa_cadastro_producto'; produto_referencia = Arreproducto_referencia; {qtde: qtde - Value(Arrqtde)}
    );;

     

     

     

     

     

     

  • Yakkek Profile Picture
    5 on at

    ForAll(
    arrPedido;
    Patch(
    'public.bra_pa_cadastro_produto';
    LookUp('public.bra_pa_cadastro_produto';
    produto_referencia = Arrproduto_referencia);
    {
    qtde: qtde - Value(Arrqtde)
    }
    )
    );;

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 393 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 278 Most Valuable Professional

Last 30 days Overall leaderboard