I am struggling to get the result I want. Want to set an alert text (in this case 'ALERT' if two criteria are met. It has to be over 10 days old and another attribute cannot be "Mapped in GIS"
I think I got into the weeds and have a mess. I know the str=Find line is not working. I am trying to just find things that contained "mapped" but this line looks to be returning everything.
Any help would be great.
var y = NOW();
var z = date($datapoint.DateTieIn);
var w = DateDiff(y,z,'days')
var str=Find("Mapped",Upper($datapoint.GISStatus))
var b = IIf((str>(-1)),5,0)
var c = iif(w>'10',1,0)
var e = Sum(b,c);
var a = iif(e==0,'',
iif(e==1,'ALERT',
iif(e==5,'',
IIF(e==6,'',"ERROR"))))
return {
textColor: '',
backgroundColor: '',
separatorColor:'',
selectionColor: '',
selectionTextColor: '',
attributes: {
a:a,
}
}
Here are my variables;
y= Todays Date
z= Date Tied In
w= Days elapsed since Tie In
str= find only those containing 'Mapped' text
b=Result of str
c=if over 10 days since tie in give a value
e= Adding results of the "Mapped" search with Days old value
a=Based on the sum in e there were 4 possible combinations I only want an alert for 1 which is (0 (not mapped) + 1 (over 10 days old)