Auto numbering

Certified Associate Developer

I have an interface where a supervisor can prioritize orders.  Is there a way that when one order ships that the numbers will automatically change to a lower number?

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    Certified Associate Developer
    in reply to Mike Schmitt

    That is what I am attempting to perform, something where either they hit a button or in the background that looks for "missing numbers: for example in the picture "5" and will take "6" and make it "5" and so on.

  • 0
    Certified Lead Developer
    in reply to AllenP

    In general, you would just need functionality that loops over the list of items (using a!forEach()), and for any item where the priority number is greater than X (where X is the priority number of the item that "shipped"), lower it by one.  This doesn't handle the use case of duplicate priority numbers very well, though, which is why I asked initially about duplicates.  It should handle gaps fine, it would just maintain the current gaps at their current distance (i.e. a jump from "5" to "9" would become a jump from "4" to "8").

  • Yea, sounds like this would be best done on the function that actually ships the order, where each lower priority order is "raised" by 1 (number lowered) once an order is shipped - one order at a time.  Is there any SAIL code that can be shared around that? (I'm still not sure where that occurs in this use case...)

    The logic for having a button on the form for users to manually click to re-prioritize can be done, but the logic is a little interesting with multiple similarly-prioritized rows and multiple possible gaps (2-3 orders ship before re-prioritizing) - and would not be my preferred solution.