Arcade in pop up

654
4
Jump to solution
10-20-2021 08:17 AM
Labels (1)
DEI
by
Occasional Contributor

Hello,

Would anyone please be willing to share how to display quarterly inspection results in a pop up using Arcade? I’m at a loss. Below is an example of what I’ve tried so far:

var Q3E = Date(2021,09,01);

var Q3S = Date(2021,05,01);

var CD = FeatureSetByRelationshipName($feature,"InsTable",["InsDate"]);

var CR = IIF(CD < Q3E && CD >= Q3S, "InsRead", "No Data");

return CR;

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

Got it. So, assuming that you've only got one inspection per quarter, you could use the First function. Also, since you're wanting the inspection results in your output, we need to include that in the FeatureSet.

Thinking about it more, too, we can include some SQL in the Filter function to get the appropriate quarter without  the need to create additional variables.

var CD = FeatureSetByRelationshipName($feature,"InsTable",["InsDate", "inspection-results-field"]);

// Filter for certain months of 2021
var CR = Filter(CD, "InsDate < '09/01/2021' AND InsDate >= '05/01/2021'")

if(Count(CR) > 0){
    return First(CR)["inspection-results-field"]
} else {
    return "No Data"
}
- Josh Carlson
Kendall County GIS

View solution in original post

4 Replies
jcarlson
MVP Esteemed Contributor

In your expression, you're trying to filter the FeatureSet CD by dates. In order to do this, you need to actually use the Filter function.

var CR = Filter(CD, "InsDate < @Q3E AND InsDate >= @Q3S")

Note that this will still only return a FeatureSet. In order to access the attributes of individual features, you will need to use a for loop or some other function.

Can you give more details on what the popup ought to look like? Do you want summary statistics of the inspection results, a single attribute, a row per inspection? Other inspection fields? Right now, your inspections FeatureSet only includes the "InsDate" field, nothing else.

- Josh Carlson
Kendall County GIS
0 Kudos
DEI
by
Occasional Contributor

Thanks @jcarlson ,

I would like to display a single attribute for each quarter in the pop up. Something like this:

DEI_0-1634745104486.png

Where each expression returns the inspection result. My thought was if I could evaluate each point's inspection dates to see if any fall within a range (or quarter), I could then return the result that was recorded from that particular date. I hope that answers your questions. I appreciate your help! 

0 Kudos
jcarlson
MVP Esteemed Contributor

Got it. So, assuming that you've only got one inspection per quarter, you could use the First function. Also, since you're wanting the inspection results in your output, we need to include that in the FeatureSet.

Thinking about it more, too, we can include some SQL in the Filter function to get the appropriate quarter without  the need to create additional variables.

var CD = FeatureSetByRelationshipName($feature,"InsTable",["InsDate", "inspection-results-field"]);

// Filter for certain months of 2021
var CR = Filter(CD, "InsDate < '09/01/2021' AND InsDate >= '05/01/2021'")

if(Count(CR) > 0){
    return First(CR)["inspection-results-field"]
} else {
    return "No Data"
}
- Josh Carlson
Kendall County GIS
DEI
by
Occasional Contributor

@jcarlson you are brilliant!!

That worked perfectly - thank you much!