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 Apps
Answered

powerapps

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi Everyone,

 

There are n items in the gallery. I would like to prevent the 2nd order of the work order. I have 2 work orders 1 without finishing the work order 2. I want to do his job according to the order to start the work order. I wonder how I do that.

 

Related Picture Below

 

Thank You Now for Your Answer

msdn.png
Categories:
  • TimRohr Profile Picture
    669 on at

    Can you clarify some of the details of your project?

    Do you mean you have 2 classifications of Work Orders? Or do you have sub-Work Orders related to a larger work order?

    What is the specific behavior you want to limit, and what is the specific set of circumstances in which you want to limit the behavior? In the case where you encounter that circumstance, what behavior do you want instead? What behavior do you want if the circumstance is NOT met?

    When you speak of doing this job "according to the order to start the work order," that sounds like a Sorting requirement. What would you be sorting on?

     

    More information will help us help you.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    There can be more than 2 work orders. no sub order.
    I want to make business orders in order. 1. Do not start 2nd or 3rd job order without

    msdn.png
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you for creating this thread @Anonymous 

     

    @TimRohr could you review the latest reply and advise if you can assist?

     

    @Anonymous

  • Verified answer
    TimRohr Profile Picture
    669 on at

    OK, if I understand, what you're saying is that you don't want action to be able to be taken on the second item in the Gallery before the first one is completed. If that is correct, then the following solution will work. You will just have to change the logical tests to match your fields.

    For my example, I have a datasource (myList) with an order field (theOrder), a field for if the work is completed (isComplete).

    In the arrow icon of your Gallery, edit the DisplayMode property to put a test of the completed items. For my mockup, that amounted to:

    If( 
    First(
    SortByColumns(
    Filter(myList, isComplete = false),
    "theOrder",
    Ascending
    )
    ).theOrder < ThisItem.theOrder,
    DisplayMode.Disabled,
    DisplayMode.Edit
    )

    So, what are we doing? I find it helpful to start at the inside and work out.

     

    Filter() -- gets the return of records that are not marked as completed

    SortByColumns() -- puts those records in an ascending order, so that the one we want to require to be the first one worked on is, in fact, the first in the returned set

    First() -- gets that first record that should be worked on (the first one not marked as complete)

    First().theOrder -- gets us the data in the sorting field so that we can compare it against our records. Only if ThisItem's sort field is equal to or less than will the DisplayMode of the button be "Edit." Put another way, if the sorted field is greater than the record that they SHOULD be working on, they WON'T be able to work on it, because the button will be disabled.

     

    CAVEAT:

    The result of this is that ANY work order at or below the current work order's sort value will have a button available. So when the user should be working on the first work order, that will be the only one with a visible/enabled button. When the first work order is marked as "completed" and the user can move on to the second work order, BOTH the first and the second work order will have the arrow icons. If you would prefer that the user is only allowed to work on the current work order (and not revisit previous work orders marked as Completed), change the less-than operator to an equals operator, and reverse the Disabled/Edit portions of the If() statement.

     

    In that case, you should consider a way to let the user edit a previously completed work order to correct some mistake (if that is allowed by whatever other governance guiding your development). For example, you could alter the color of the arrow icon based on whether the work order was marked as "completed" or not.

    If(ThisItem.isComplete, orange, black)

    That way, only the latest work order to become available to the user would have an arrow of one color, while all other arrows for the completed work orders would be of a different color. If the process would be different for editing a completed item versus editing an in-process item, you'd add an If() statement in the OnSelect event of the arrow icon.

     

  • TimRohr Profile Picture
    669 on at

    I should be clear... changing the color of the arrow icon won't matter if you are ONLY showing the arrow for the one work order they should be working on (that is, going with the "=" in the formula so you only get one icon button in the Gallery).

     

    My suggestion is to NOT go with the "=" if you need to be able to allow editing previously completed work orders. Instead, change the color and fiddle with the OnSelect event to control the apps behavior.

     

    (Because the other option, using the "=" operator but also needing to allow edits, would be adding another control that would become visible/enabled only when an item was marked "completed," and which would have its own OnSelect event... and that just gets cumbersome for editing later.)

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 225

#3
M Bilal Khan Profile Picture

M Bilal Khan 192

Last 30 days Overall leaderboard