Maximo

 View Only
Expand all | Collapse all

Restricting duration to 30 minute incrementation- numeric range domain with duration issue

  • 1.  Restricting duration to 30 minute incrementation- numeric range domain with duration issue

    Posted Thu April 27, 2023 01:45 PM

    Hi All!

    I'm trying to figure out the best practice way to restrict labor duration entries to increments of 30 minutes only.  I tried going down the numeric range domain route, but the min/max and interval fields round to the nearest whole value.  I also noticed that this runs far slower than I would expect when validating.  Does anyone have a good solution for this type of need or really any examples of using numeric range domains with duration fields outside of whole number value range restrictions/intervals?

    Just as an example, 0:30 (0.5), 1:00 (1), 1:30 (1.5) are acceptable values but 1:12 (1.2) should error.

    Thanks!



    ------------------------------
    Valerie Petty
    ------------------------------


  • 2.  RE: Restricting duration to 30 minute incrementation- numeric range domain with duration issue

    IBM Champion
    Posted Thu April 27, 2023 02:10 PM

    Hello Valerie,

    Create an Attribute Launch Point automation script given below and add each attribute you need this validation-

    attrDate = mbo.get("<ATTRIBUTENAME>")
    if attrDate is not None:
       dateFormat = "HH:mm:ss"
       timeString = attrDate.strftime(dateFormat)
       timeArray = timeString.split(":"
       hrs = int(timeParts[0])
       min = int(timeParts[1])
       sec = int(timeParts[2])
       if min % 30 != 0:
           raise TypeError("Only 30-minute intervals are allowed")


    ------------------------------
    Prashant Sharma
    Maximo Solution Architect
    ------------------------------



  • 3.  RE: Restricting duration to 30 minute incrementation- numeric range domain with duration issue

    Posted Fri April 28, 2023 11:01 AM

    Prashant,

    This is a nice solution! Easy and quick to implement.

    Valerie,

    Note: If you are using mobility you will want to add this to your mobile solution for offline validation.  For Maximo Anywhere or Mobile Maximo you can very nearly copy and paste this code from your automation script into the app's custom Java Script code block.  That way when you uses are offline you will have validation at the moment of data entry and not after they have already completed the work and moved on to the next job.



    ------------------------------
    Bradley K. Downing , MBA
    Senior Brand Technical Specialist
    IBM
    Bakersfield CA
    ------------------------------