Linking a Value to a Pick List

Viewing 2 reply threads
  • Author
    Posts
  • May 13, 2023 at 9:45 AM #49411

    Tom Seputis
    Participant

    I have a use case of creating some maintenance logs for several items. An example is routine maintenance and replacement items on a CPAP machine. I am having trouble figuring out how to auto populate the next service date. The next service date is based on the specific item and the needed interval. I can get it to add X number of days to the entered current service date. But I can’t adjust the service interval based on the item selected. Trying to do IF “Filter” then interval = 14 and things like that. Only using the DATEADD function has worked for me but I can’t figure out how to make the # of add days a variable.

    Not sure if this can all be done with calculations or needs scripting.

    Simple case with fields and values is as follows:

    Item: From pick list choose. Filter, Tubing.
    Date Serviced: Enter date serviced.
    Next Service Date: Auto calculate based on Item selected and service Interval.
    Comments:

    Service intervals: Filter – 14 days and tubing 90 days.

    An help and or recommendations would be greatly appreciated.

    Thanks,
    Tom

    • This topic was modified 1 year, 7 months ago by Tom Seputis.
    May 13, 2023 at 7:56 PM #49416

    Brendan
    Keymaster

    Hi Tom,

    You can do this with the DATEADD() function and the IFEQUAL() function.

    For example:

    DATEADD(Date;0;IFEQUAL(Service Interval; "Filter"; 14; IFEQUAL(Service Interval; "Tubing"; 90; 0)) ;0;2;0;0;0)

    the IFEQUAL() function takes 4 parameters. A field, a value to compare the field with, a return value if the field equals the value, otherwise another value if they’re not equal.

    It does get a little complex when you’re embedding functions within other functions. It’ easier to understand scripting code though, so you could also do this using JavaScript.

    Hope that helps!

    May 16, 2023 at 6:58 PM #49429

    Tom Seputis
    Participant

    Hi Brendan,

    Thanks for setting me in the right direction. I came up with the calculation below for 2 of the items. It works so that based on selected item the next service date is given. I will need to finish up for the other components of the CPAP machine. I am also getting other ideas to use TapForms for other scheduled maintenance around the house.

    DATEADD([Date];0;0;0;IFEQUAL([Item]; “Filter”; 14; IFEQUAL([Item]; “Tubing”; 90; 0)) ;0;0;0)

    Thanks
    Tom

    • This reply was modified 1 year, 7 months ago by Tom Seputis.
Viewing 2 reply threads

You must be logged in to reply to this topic.