|
POST
|
You have to use the Expects function at the top of the script when using a variable for the field. Expects($feature, "Type")
var stuff = {
"0": "SCC",
"101": "SEP",
"4": "CLT",
"23": "CGS"
};
var keyField = "Type";
// Look up the value based on the key from the field
var lookupKey = Text($feature[keyField]);
var lookupResult = Dictionary(stuff)[lookupKey];
return lookUpResult;
... View more
10-26-2023
11:54 AM
|
1
|
1
|
5775
|
|
POST
|
Also note that I modified the first response to include that you also have to convert the numeric attribute to a string to return a value in the Dictionary.
... View more
10-26-2023
11:36 AM
|
1
|
3
|
5785
|
|
POST
|
Here's an example using the sample dataset in the Playground (with the first key changed to "1" to get a result) // Returns the first feature in the layer
var feat = First(
// Fetches features from a public portal item
FeatureSetByPortalItem(
Portal("https://www.arcgis.com"),
// portal item id
"7b1fb95ab77f40bf8aa09c8b59045449",
0, // layer id
["*"], // fields to include
false // include or exclude geometry
)
);
var stuff = {
"1": "SCC",
"101": "SEP",
"4": "CLT",
"23": "CGS"
};
var keyField = 'HasData'
var lookupKey = Text(feat[keyField]);
return Dictionary(stuff)[lookupKey] playgroudn.png
... View more
10-26-2023
11:32 AM
|
1
|
4
|
5786
|
|
POST
|
A key in the dictionary must be a string, not a number. You'll have to convert your field value to a string, in addition. Here's an example that works. var stuff = {
"0": "SCC",
"101": "SEP",
"4": "CLT",
"23": "CGS"
};
var test = Text(0);
var lookupResult = Dictionary(stuff)[test]
... View more
10-26-2023
11:06 AM
|
2
|
6
|
5844
|
|
POST
|
Are you using Enterprise? This new capability was just released in v1.24 and is only available in ArcGIS Pro 3.2, ArcGIS Online, and ArcGIS Maps SDK for Javascript 4.28. If you're on AGOL, this should be available after tonight's upgrade.
... View more
10-25-2023
06:49 AM
|
0
|
0
|
7228
|
|
POST
|
You can create a web map where there is only one layer visible at a time and use that in your app. Take a look at this blog that shows how to do it.
... View more
10-24-2023
07:03 AM
|
0
|
1
|
1405
|
|
POST
|
I've heard that it will be announced on Wednesday, Oct 25th.
... View more
10-23-2023
11:04 AM
|
2
|
1
|
2732
|
|
POST
|
Instead of using the Intersects SpatialRelationship, try Contains
... View more
10-20-2023
01:28 PM
|
0
|
0
|
2269
|
|
POST
|
The documentation for SpatialQeryFilter has an example that selects all features within the current map view. Does this return any values? var sz = MapView.Active.GetViewSize();
var map_pt1 = MapView.Active.ClientToMap(new System.Windows.Point(0, sz.Height));
var map_pt2 = MapView.Active.ClientToMap(new System.Windows.Point(sz.Width, 0));
//Convert to an envelope
var temp_env = EnvelopeBuilderEx.CreateEnvelope(map_pt1, map_pt2, MapView.Active.Map.SpatialReference);
//Project if needed to the layer spatial ref
SpatialReference sr = null;
using (var fc = featSceneLayer.GetFeatureClass())
using (var fdef = fc.GetDefinition())
sr = fdef.GetSpatialReference();
var env = GeometryEngine.Instance.Project(temp_env, sr) as Envelope;
//Set up a query filter
var sf = new SpatialQueryFilter()
{
FilterGeometry = env,
SpatialRelationship = SpatialRelationship.Intersects,
SubFields = "*"
};
//Select against the feature service
var select = featSceneLayer.Select(sf);
if (select.GetCount() > 0)
{
//enumerate over the selected features
using (var rc = select.Search())
{
while (rc.MoveNext())
{
using (var feature = rc.Current as Feature)
{
var oid = feature.GetObjectID();
//etc.
}
}
}
}
... View more
10-20-2023
01:08 PM
|
0
|
2
|
2274
|
|
POST
|
You can built the link using information gathered from the fields from the feature. The example @JeffreyThompson2 shows is one way of doing that, but you can also built the link with more complex code in Arcade and put that result into an Arcade element to make it clickable. If you have trouble constructing the code, if you provide some information about the fields and the link you'd like to build, we can help with that.
... View more
10-20-2023
11:16 AM
|
0
|
0
|
8287
|
|
POST
|
Try this script var furl = IIf((!IsEmpty($feature.Website) && Left(Lower($feature.Website), 4)=='http'), $feature.Website, Concatenate(['https://', $feature.Website]))
var website = IIf(IsEmpty($feature.Website), "", `<br><a href="${furl}"><strong>Website Link</strong></a>`)
var grades;
if(!IsEmpty($feature.Grade_Lowest_NS12) && $feature.Grade_Lowest_NS12 > -99) grades += ` <br><strong>Grades:</strong> ${$feature.Grade_Lowest_NS12}`
iif(!IsEmpty($feature.Grade_Highest_NS12) && $feature.Grade_Highest_NS12 > -99, grades += ` - ${$feature.Grade_Highest_NS12} `, ` `)
return {
type : 'text',
text : `<p>
<strong>Type:</strong> ${$feature.Type} ${grades}${website}
</p>
<p>
<strong>Address:</strong>
<br>
${$feature.Site_Address_Line1} ${$feature.Site_Address_Line2}
<br>
${$feature.Site_City}, ${$feature.Site_State} ${$feature.Site_Zipcode}
</p>`
}
... View more
10-19-2023
01:10 PM
|
0
|
1
|
1681
|
|
POST
|
You didn't close out the for loop before the else on line 37 Try this: var fsn = $feature.FullStreetName;
var streetLayer = FeatureSetByName($datastore, "server.dbo.StreetCenterline");
var pre = $feature.PreDirection;
var sn = $feature.StreetName;
var st = $feature.StreetType;
var post = $feature.PostDirection;
var searchDistance = 150;
var streetIntersect = Intersects(streetLayer, Buffer($feature, searchDistance, "feet"));
var cnt = Count(streetIntersect);
var minDistance = Infinity;
if (cnt > 0) {
for (var street in streetIntersect) {
var dist = Distance(street, $feature, "feet");
if (dist < minDistance) {
var stparse = {
attributes: {
pre: ["streetLayer.PreDirection"],
sn: ["streetLayer.StreetName"],
st: ["streetLayer.StreetType"],
post: ["streetLayer.PostDirection"],
fsn: ["streetLayer.FullStreetName"],
minDistance: dist
}
}
} else {
var stparse = {
attributes: {
pre: "",
sn: "",
st: "",
post: "",
fsn: ""
}
}
}
}
} else {
// pass no features found within search distance, name remains null
var stparse = {
attributes: {
pre: "",
sn: "",
st: "",
post: "",
fsn: ""
}
}
}
return stparse;
... View more
10-19-2023
12:10 PM
|
0
|
1
|
1485
|
|
POST
|
You need to add the html tags to make it clickable. Note that you still have the quotes clashing. Since you have to put the URL in yet another set of quotes, it's easier to use template literals and the back tick. return {
type : 'text',
text : `<a href="https://keyweb.pittgov.net/WebPAAS/?DEST=pDetail&pKEY=(${$feature['ASSESSED_G']})">${$feature['ASSESSED_G']}</a>`
}
... View more
10-19-2023
07:09 AM
|
0
|
0
|
1667
|
|
POST
|
The quotes are causing the problem 'https://webaddress=pDetail&pKEY=(' + $feature["ASSESSED_G"] + ')'
//or using template literals
`https://webaddress=pDetail&pKEY=(${$feature["ASSESSED_G"]})`
... View more
10-18-2023
03:00 PM
|
2
|
2
|
1701
|
|
POST
|
You don't need a WebMap, such as shown in this example. You can make a FeatureLayer from a JSON file (shown here), add it to your view, and use it in the FeatureTable.
... View more
10-18-2023
12:34 PM
|
0
|
1
|
1313
|
| Title | Kudos | Posted |
|---|---|---|
| 3 | 2 weeks ago | |
| 1 | 02-04-2025 06:39 AM | |
| 1 | 05-01-2026 08:26 AM | |
| 1 | 04-10-2026 12:01 PM | |
| 1 | 04-13-2026 09:11 AM |
| Online Status |
Offline
|
| Date Last Visited |
a week ago
|