Deep dive two: reset prevention and merging

The functionality that we will discuss in this post is probably not going to be used on a daily basis, and therefore good to give some special attention to, for the rare cases that you will need them.

Reset prevention

As you may have read in previous posts, the maintenanceman.nl API allows you to restart counting the interval for one item if another gets executed, through the ‘willReset‘ field of each schedule item in the request body. (For an example and detailed explanation of this, please see the post ‘Setting up your first API request‘). Although the behavior of this will be desirable in most situations, you might run into one specific situation that will make you want to opt out of this. Let’s illustrate this by an example.

Imagine that you have a truck (indeed the same truck as in previous examples) that will require an oil change every X kilometers (which is a relatively short interval) and after Y kilometers (a very long time) it will require an engine overhaul. Once the overhaul is executed, the oil change interval can of course restart counting from zero because the overhaul already includes an oil change. All of this can be neatly arranged in the normal parameters, so no issues so far.

Now let’s imagine that the mileage for the overhaul interval is exceeded and the overhaul is postponed for whichever unspecified reason. The API will now return the overhaul as immediately due and act as if the overhaul is executed per the specified currentDate, effectively resetting the oil change interval per the same date, even though we know that the overhaul is not actually executed and the oil was not changed.

To prevent this from happening, you can set the optional preserveOnOverdueReset parameter on the schedule item for the oil change to true. If this is done, the reset will only be triggered by actual executions or future planned executions of the resetting schedule item (i.e the overhaul).

Merging

On the other hand you may in some cases like to postpone a certain schedule item if another schedule item, that will reset this one will occur within a short time after the current one. E.g, if the oil change from our previous example will be scheduled only one or two weeks (or X kilometers) before the overhaul that will include an oil change anyway, you will probably want to forget about the individual oil change and postpone it until the overhaul takes place.

To accomplish this, you can easily include a mergeLimit object in the schedule item parameters, which can contain a units parameter and/or an orDays parameter. Similar to the interval parameter, you can use this to specify a how much asset usage measuring units (kilometers in our example) or calendar days must at least fall between the execution of a schedule item and its resetter. In our example, if we set the merge limit to 10.000km or 90 days, the oil change will no longer be scheduled if the overhaul is less than 10.000 km or 90 days away.

Warning

Please note that both reset prevention and merging should be used with caution as they might lead to unexpected results when used together. E.g, the before mentioned oil change could first be removed from the schedule based in the merge limit and suddenly reappear later as a result of reset prevention if the overhaul is postponed for some reason.

Leave a comment