ArcGIS Onlineで、今日の日付がClosedDateフィールドの日付とReopenDateフィールドの日付の間にある場合にポリゴンに「Closed」とラベルを付け、日付の範囲外の場合、またはいずれかのフィールドが空欄の場合は何もラベルを付けない式を作成しようとしています。
ポップアップがあるため、「Closed」という値のフィールドを作成することはできません。このテキストでユーザーを混乱させたくないからです。
皆さん、ありがとうございます。
You can use this syntax
if ($feature.ClosedDate <= Today() && Today() <= $feature.ReopenDate) return "Closed";
This work perfectly. Thanks, Ken.
And it automatically excludes any instances where the ClosedDate and/or ReopenDate fields are blank?
Would both of them be blank or would you have cases where only one is blank?
A better question is what would you want to see if one if blank and the other isn't.
they could both be blank because some fields aren't closed at any time in which case there is no label
The only case where it wouldn't return null with blank fields is if the ClosedDate was blank and the ReopenDate was after today. That would return "Closed". That's why I was asking what you would want to show if one field was blank but the other had a Date.
You can test the variants in the Arcade Playground with this code.
var ClosedDate = null; //var ClosedDate = Date(2024,1,1); var ReopenDate = Date(2024,1,14); //var ReopenDate = null; if (ClosedDate <= Today() && Today() <= ReopenDate) return "Closed";
サインインすると、投稿したり、更新をフォローしたりできます。初めての方ですか?無料アカウントを登録しましょう。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.