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 / Calculation in a Colle...
Power Apps
Unanswered

Calculation in a Collection

(0) ShareShare
ReportReport
Posted on by 122

Dear all,

 

Hope someone can help me to find a solution.

i have a collection like this in powerapps

PMO_CH_0-1628692328778.png

There is a current value "Anzahl" (Stockmanagement) and a MinimumStock- value.

 

I'm looking for a solution to inform the product-owner (Field "ToInformInCaseOf) with an email or teams-message if the current value (Anzahl) is smaller than the MinimumStock-Value.

 

Thank you very much 🙂

 

 

Categories:
I have the same question (0)
  • Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at

    Hey! 
    When you create the item to to the collection you can check the product and check if anzahl < MinimumStock-Value
    Then, you use function MailTo

  • PMO_CH Profile Picture
    122 on at

    Hy Nogueira1306 

     

    Sounds good, but unfortunately i need more help from your end. I don't know where to begin with this command.

    Thank you very much.

  • Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at

    Hey! Just tell me how do you create the collectipn. Print from the form and the code of the Collect()

  • PMO_CH Profile Picture
    122 on at

    Hi,

    It looks heavy and for sure there is the possibility to shrink the code, but don't know how and do that in many small steps 🙂

    Look at the bottom to find the creation in the collection.

    SubmitForm(EditForm1);;
    Navigate(Screen1);;
    ClearCollect(
     spArticleMinimumRest;
     StockArticle
    );;
    ClearCollect(
     spData;
     StockData
    );;
    ClearCollect(
     spDataLast;
     StockData
    );;
    ClearCollect(
     spDataLast;
     Filter(
     spDataLast;
     WasOrder = true
     )
    );;
    ClearCollect(
     spDataLastUnitPrice;
     AddColumns(
     spDataLast;
     "Lagerwert Unit CHF";
     Sum(EK_x002d_Preis / (MengeProEinheit * AnzahlGeliefert));
     "Lagerwert Unit EUR";
     Sum(EK_x002d_PreisAT / (MengeProEinheit * AnzahlGeliefert))
     )
    );;
    ClearCollect(
     spDataGroup;
     AddColumns(
     GroupBy(
     spData;
     "Title";
     "Category";
     "ArtNr";
     "GroupedTitle"
     );
     "Anzahl";
     Sum(
     GroupedTitle;
     ((AnzahlGeliefert * MengeProEinheit) - CarriedOutAnzahl)
     )
     )
    );;
    ClearCollect(
     SemiFinalDataCollection;
     AddColumns(
     spDataGroup;
     "MinimumStock";
     LookUp(
     spArticleMinimumRest;
     Artikel_x002d_Nr_x002e_ = spDataGroup[@ArtNr];
     Mindestbestand
     );
     "ToInformInCaseOf";
     LookUp(
     spArticleMinimumRest;
     Artikel_x002d_Nr_x002e_ = spDataGroup[@ArtNr];
     ToInformInCaseOf
     )
     )
    );;
    ClearCollect(
     UltimateDataCollection;
     DropColumns(
     SemiFinalDataCollection;
     "GroupedTitle"
     )
    );;
    RemoveIf(
     StockView;
     true
    );;
    ForAll(
     UltimateDataCollection;
     Patch(
     StockView;
     Defaults(StockView);
     {
     ArtNr: ArtNr;
     Title: Title;
     Category: Category;
     Stock: Anzahl;
     MinimumStock: MinimumStock;
     ToInformInCaseOf: ToInformInCaseOf
     }
     )
    )

     

  • Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at

     

    This is just checking for First Item because I am assuming that you dont delete all items and re create the collection, I am assuming that you patch 1 item at a time

     

    If you need additional help please tag me in your reply.
    If my reply provided you with a solution, pleased mark it as a solution ✔️!

    Best regards,
    Gonçalo Nogueira

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 547

#2
WarrenBelz Profile Picture

WarrenBelz 444 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 322

Last 30 days Overall leaderboard