Hi there,
I am creating a map to perform inspections on several locations. These locations have different quality to be maintained at, "onderhoudskwaliteit". During the inspection, the quality will be noted in the survey, "kwaliteit_inspectie". There are several answers possible when there is no maintenance needed and vice versa. I have written these answers in the expression so the expression knows what to return. So far so good I believe.
The next step is, to check the inspection date when the expression returns 'Geen onderhoud'. When this is returned, the expression needs to return "Onderhoud in verschiet" after 14 days, and "Onderhoud uitvoeren" after 28 days.
Since I'm not that good yet at writing expressions I would like some help with this. So far I have written the expression shown below, but this one isn't working yet. Where am I making mistakes, or how would you guys write this expression?
Thank you in advanced!
var inspectie = $feature.kwaliteit_inspectie
var kwaliteit = $feature.onderhoudskwaliteit
var days = DateDiff(Now(), $feature.CreationDate, "days")
when(
kwaliteit "B" == "A+", "Geen onderhoud",
kwaliteit "B" == "A", "Geen onderhoud",
kwaliteit "B" == "B", "Geen onderhoud",
kwaliteit "B" == "C", "Onderhoud uitvoeren",
kwaliteit "B" == "D", "Onderhoud uitvoeren",
kwaliteit "C" == "A+", "Geen onderhoud",
kwaliteit "C" == "A", "Geen onderhoud",
kwaliteit "C" == "B", "Geen onderhoud",
kwaliteit "C" == "C", "Geen onderhoud",
kwaliteit "C" == "D", "Onderhoud uitvoeren"
)
when(
"Geen onderhoud"
if (days > 14) {
return "Onderhoud in verschiet";
}
if (days > 28) {
return "Onderhoud uitvoeren";
else {
return "Geen onderhoud";}