Arcade Data expression on a dashboard indicator to match and filter two layers based on date fields (range)

1525
4
05-17-2021 04:11 AM
KIVANC
by
New Contributor II

Hi all

Let me please explain what I am trying to do briefly.

I have two feature sets; one hosted table showing tide values in 10 minutes interval (date field and tide field), and one hosted feature layer showing vessel berths with ETA and ETD fields among others. 

I was tasked with creating a dashboard to check if the tide values are within the accepted range during the berthing. So dashboard should display minimum available tide when a specific berthing is selected.

Best solution would be to display required value on an indicator and minimum tide value available from the tide chart as a reference value. But since this is a range, I cannot do this automatically. I think the solution lies in arcade data expressions. 

My hypothetical solution is to create a variable which filters the tide table based on the ETA -ETD interval and then minimum value can be displayed easily on the indicator as a statistic later on. Of course this ETA - ETD value should be specific to each berthing.

Since I have limited time for this particular task, and limited knowledge with arcade, I appreciate any help. 

Am I one the right track? If so could you please help me with the arcade data expression?

Many thanks

Kivanc

0 Kudos
4 Replies
DavidPike
MVP Frequent Contributor

I'd probably say you're on the right rack with Data Expressions. Create effective data expressions—ArcGIS Dashboards | Documentation

I would probably first grab both Feature Sets using FeatureSetByPortalItem (look at the examples in the above link to restrict the fields returned and set geometry = False)

It will get complicated from here, as I guess you would then loop through all the Tide dates to find values between our ETA and ETD, and then choose the minimum tide value.  This would require a loop for each ETA-ETD then within that, you loop through the tide dates.

After you have this value, you would then insert it, along with all your other attribute values from the original FeatureSet into a JSON Feature Set representation as demonstrated in the last example of the above link.

It's not brain surgery but I'd say it's not going to done quickly if time is a factor and you've not dealt with these expressions much before.

0 Kudos
KIVANC
by
New Contributor II

Hi David

Many thanks for your reply. 

I thought it would be easier for me to keep it simple in arcade by leaving the selection of the min value to the indicator widget rather than finding in the expression. 

After bringing in both layers is it possible to use filter function and somehow make use of those layers?

var Tide = .......

var Berth = ....... //has ETA and ETD//

var TideFiltered = // filter expression that removes features from the tide having dates <ETA and >ETD //

Then on widget I can say statistics - minimum to the reference section.

 

0 Kudos
DavidPike
MVP Frequent Contributor

I don't quite get what you mean.  Filter() would be used against the entire FeatureSet in that case which doesn't make sense.

I think you might be missing what the Data Expression is, it returns a FeatureSet which you then can filter using category/date selectors - filtering within the Indicator widget/dashboard element isn't logical (to me at least).

0 Kudos
KIVANC
by
New Contributor II

Thanks David. I think I confused myself with it, you are right. I will explore more when I have the time.

0 Kudos