What I have:
- A hosted joined view layer with a Inspection Date field ('insdate') and an Operable field ('h_operable'). The view is defined such that it only holds the most recent record for each asset. I.e. Assetid 1 will have a single Inspection Date and operable value. The table currently has several records with inspection dates shown below:
What I am trying to accomplish:
- If Inspection date is less than 1 year old and Operable is equal to 1 then symbology class would be "Operable".
- If Inspection date is less than 1 year old and Operable is equal to 2 then symbology class would be "Inoperable"
- If inspection date is more than 1 year old then symbology class would be null or other and not displayed.
What I have tried: The following code is what I have attempted to use in the Style Options expression in MapViewer
var now = Date();
var inspection = $feature["insdate_1682094024219"];
var age = DateDiff(inspection, now);
var op =$feature["h_operable"];
var opcondition = age < 365 && op == 1;
var inopcondition = age < 365 && op == 0;
var nodraw = age > 365
When(opcondition, "Operable", inopcondition, "Inoperable", nodraw, "Other", "Inconclusive");
Issue:
- Whenever I apply, the
op == x
value is honored, and drawn as defined invar opcondition
orvar inopcondition
. However, the date parameter is NOT honored, and records that are more than 365 days old still draw as"Operable"
or"Inoperable"
instead of"Other"
. This is pictured below, where the date is more than 1 year old, and still being drawn on the map.