Hello,
I have a text widget that is linked to an interactive map. the widget displays information relating to cycling infrastructure, and has two expressions: one that indicates the total length of cycle track (a type of cycling infrastructure) based on the map extent, and the other, percent of total network based on the map extent.
For example, if there is a total of 10 kilometres of cycling infrastructure displayed on the map, and there's 2 kilometres of cycle track infrastructure, then the widget would display: CYCLE TRACK 2 Km Total Length, 20% of Total Network.
My issue is with the expression I'm using for percent of total network:
SUM({Length_km})/SUM({Length_km})*100
The first SUM being the total length of Cycle Track, the second SUM being the total length of all cycling infrastructure. The widget is connected to two Views: the default view and one with the filter: Cycling Infrastructure is Cycle Track.
The issue with this expression is that when I zoom into an area that has no cycling infrastructure, the widget displays: CYCLE TRACK 0 Km Total Length, Expression 1% of Total Network
Can someone help me edit this arcade expression so that when either the numerator or denominator of the expression has a value of zero, the widget displays: 0% of Total Network
