Hi friends,
So this post contains two things:
1. I have a serial chart in a dashboard, and I filtered the layer to just shows 2 subtypes, but when I configure the equation, it is not able to include more than one subtype, as per the below screenshots:
2. Is it possible to configure a serial chart from multiple layers, I actually have two layers (one have a main line and the other have laterals (subtypes) of the line), and want to create a serial chart to see the lengths of all lines (main + laterals) in one serial chart. Is this doable?
@JayantaPoddar
@jcarlson
@JohannesLindner
@DavidNyenhuis1
Disclaimer: This is the first time I'm looking at Dashboard Serial Charts, it's possible I'm overlooking things here.
1.) If "Include" doesn't work, try chaining together multiple "Equals" with "Or". So instead of
WHERE Field IN (Value1, Value2)
you get
Where Field = Value1 OR Field = Value2
2.) Doesn't seem doable. You probably have to create a new database view with all the lines, share it and build your chart from that.
Thank you very much for the prompt response. Much appreciated.
So in this case will try to publish another layer that combines all (main + laterals).
You can definitely do this with a Data Expression. They can look a bit more complex, but they're really just longer than most Arcade expressions. Take a look at the examples repository for a good starting point.
The text version:
The code:
var portal = Portal('your url')
var lines1 = FeatureSetByPortalItem(
portal,
'itemid',
0, // or whatever layer index applies
['fields', 'you', 'need'],
false // unless you really need the geometry, leave it out for performance reasons
)
var lines2 = FeatureSetByPortalItem(
portal,
'itemid',
0,
['fields', 'you', 'need'],
false
)
var lyrs = [lines1, lines2]
var features = []
var feat;
for (var lyr in lyrs){
for (var l in lyrs[lyr]){
feat = {
attributes: {
some_attribute: l.some_attribute,
another: l.another,
...
}
}
Push(features, feat)
}
}
var fs_dict = {
fields: [
{name: 'some_attribute', type: 'esriFieldTypeString'},
{name: 'another', type: 'esriFieldTypeInteger'},
...
],
geometryType: '',
features: features
}
return FeatureSet(Text(fs_dict))
Note that this expression assumes you've got the same fields in each layer. If all you want is the length, you probably only need "shape__length" anyway, but some other type or identifier may be useful.
Hi @jcarlson
Thank you very much for the great support. I tried the code you provided but seems I need to be more familiar with the Data Expression. Much appreciate your response.