If job type is X then next service date is

#1

I have a column called job type it’s a list of services we provide. I’m trying to auto populate the “Next Service Date” field based on job type and last service date.

so something like if job type = dryer then add 365 days to the last service date. Or if the job type = air duct cleaning then add 1095 day to the last service date.

Just as a note - the last service date column is a date field. I can change that if necessary.

I got it to work with IF({Job Type} = “Dryer”, DATEADD({Last Service Date},2, ‘year’)

but now I’m trying to add an ELSE IF (I think) for this: IF({Job Type} = “Air Ducts”)DATEADD({Last Service Date},3, ‘year’))

So basically if the job is a dryer we add on 2 years until next service, if it’s air ducts we add 3 years until next service.

0 Likes

#2

I hadn’t tried this before, but I was able to use SWITCH() inside of a DATEADD. As long as all of your additions are the same type (i.e. all days, or all years, or all ???), this will work. Here’s a quick example:

DATEADD({Last Service Date},
    SWITCH({Job Type}, "Dryer", 365, "Air Duct", 1095)
    , "days")

NOTE: this doesn’t provide a default value to fall back on if {Job Type} isn’t one of the options in your SWITCH statement, but you can add one of your liking to the end.

0 Likes