|
POST
|
No, this shows the results of the one-line code. The two highlighted points show the Data field above and below 40 code.png
... View more
01-31-2024
06:05 AM
|
1
|
2
|
5724
|
|
POST
|
You can use this Expression if ($feature.C2 > 40) return $feature.C1
... View more
01-31-2024
05:56 AM
|
2
|
4
|
5771
|
|
POST
|
There's an updated version the AGO Assistant available at https://assistant.esri-ps.com/signin. The older version hasn't been updated in a few years.
... View more
01-23-2024
07:56 AM
|
0
|
0
|
7265
|
|
POST
|
This code will return the list of townships, leaving out the blank ones. Expects($feature, 'Townshi*'); //Requests all fields beginning with "Townshi"
var fieldArr = ['Township','Township2','Township3','Township4','Township5','Township6','Township7'];
var output = [];
for (var index in fieldArr) {
if (!IsEmpty($feature[fieldArr[index]])) Push(output, $feature[fieldArr[index]])
}
return Concatenate(output, ", ")
... View more
01-23-2024
06:58 AM
|
3
|
0
|
18095
|
|
POST
|
The Count function cannot take a null, so you'll have to check if the Intersects function returns a null. var retail_layer = FeatureSetById($map, "18d1d756020-layer-70");
var radius = Buffer($feature,.75,"miles");
var result = Intersects(retail_layer, radius);
if (IsEmpty(result)) return 'No features found';
var retail_count = Count(result);
return retail_count; The second code worked as expected in my testing (changing the layer id and the field for the retail list)
... View more
01-19-2024
12:43 PM
|
0
|
0
|
1079
|
|
POST
|
In the FeatureSetByPortalItem function, you have to include the "Status" field on the fields parameter when getting the FeatureSet and you were missing a closing quote for the Digital_Co field. The Filter function uses a FeatureSet as an input. You also have to put quotes around your filter expression and the "in" operator uses parentheses, not brackets. // Reference layer using the FeatureSetByPortalItem() function.
var fs = FeatureSetByPortalItem(Portal('https://my-site.pr.portal'), 'b19q57894c8521f58e68t87412' , 0, ['Status', 'Printed_Co', 'Digital_Co'], false);
var sumPrintedCo = Sum(Filter(fs, "Status in ('Complete/Delivered', 'Rdy for PickUp')), 'Printed_Co');
var sumDigitalCo = Sum(Filter(fs, "Status in ('Complete/Delivered', 'Rdy for PickUp')), 'DigitalCo');
sumPrintedCo + sumDigitalCo
... View more
01-16-2024
07:52 AM
|
1
|
0
|
1038
|
|
POST
|
This isn't the most efficient code, so I can imagine it's slower with longer array lists. Since it has to make a query for each item in the list, multiple requests are sent back to the server. You might look at @jcarlson's blog about "memorizing" the table and see if that makes a measurable difference. You could also just read the table into a dictionary and use the code field as a key to get the URL value instead of using the Filter on the Table.
... View more
01-11-2024
06:53 AM
|
0
|
1
|
3389
|
|
POST
|
Here's one way of doing it. I'm using a table I set up that has the codes and their associated URLs. In the Arcade element, I get the codes from the feature (here I use a dummy variable in lieu of an actual feature), split them into an array, and loop through that array. For each code, I get the URL from the table and create an href, which is pushed into an array. That array is concatentated with the Data Source text. var feat = 'WoodOthers1948 | Barnes1953 | HailOthers1971';
var source = FeatureSetByPortalItem(myPortal, myTableId, 0, ['Code', 'URL'], false)
var arr = Split(feat, " | ")
var output = []
for (var index in arr) {
var code = arr[index]
var pub = Filter(source, "Code = @code")
var item = `<a href="${First(pub).URL}">${code}</a>`
Push(output, item)
}
return {
type : 'text',
text : `<b>Data Source:</b> ${Concatenate(output, " | ")}`
} This returns this popup, with each link functional popup8.png
... View more
01-10-2024
11:46 AM
|
2
|
15
|
5732
|
|
POST
|
In my functions to run Geoprocessing tools, it's an async Task and uses await when calling the ExecuteToolAsync method. Here's an example of one of my functions that uses the Dissolve tool. public static async Task<IGPResult> DissolveFeatures(FeatureClass featureClass, string DissolveFields, string StatsFields, string OutputName, GPExecuteToolFlags flags = GPExecuteToolFlags.None)
{
List<object> arguments = new()
{
featureClass,
OutputName,
DissolveFields,
StatsFields
};
IGPResult result = await Geoprocessing.ExecuteToolAsync("management.Dissolve", Geoprocessing.MakeValueArray(arguments.ToArray()), null, null, null, flags);
return result;
}
//this is how I use the function and the returned result
bool results = await QueuedTask.Run(async () =>
{
//lots of code
path = geodatabase.GetPath().AbsolutePath
IGPResult DissolvedSummaryResult = await Utilities.DissolveFeatures(JoinFC, StrataFieldName, StatField, $"{path}\\JoinedPointDissolve", GPExecuteToolFlags.None);
if (DissolvedSummaryResult.IsFailed)
{
// do something if it fails
return false;
}
using FeatureClass DissolveSummaryFC = geodatabase.OpenDataset<FeatureClass>("JoinedPointDissolve");
//lots more code
)}; I also notice you're not specifying the Toolbox where ExtractByMask is located in the tool path property. In my code, the tool is in the Data Management toolbox, so I call it using "management.Dissolve". If you look at the documentation for the tool you're using, in the Parameters section, you can see how it's called in Python. To use it in .NET, just remove "arcpy." python.png
... View more
01-10-2024
09:08 AM
|
0
|
0
|
2473
|
|
POST
|
When you create the FSAValue layer, you're only including the FSA field and leaving off the LDU field. Give this code a try var FSAvalue = FeatureSetByName($datastore, "ADDR_Postal_Code_Boundaries", ["FSA", "LDU"], false);
var intersectLayer = Intersects(FSAvalue, $feature);
if (Count(intersectLayer) > 0) {
var layer = First(intersectLayer);
if (layer != null) return layer.FSA + " " + layer.LDU;
}
return null;
... View more
01-09-2024
12:10 PM
|
1
|
1
|
2135
|
|
POST
|
Line 11 should look like this result = layer.FSA + " " + layer.LDU;
... View more
01-09-2024
11:42 AM
|
1
|
3
|
2144
|
|
POST
|
Glad to help. Don't forget to click the Accept as Solution button on the post that answered your question.
... View more
01-09-2024
09:28 AM
|
0
|
0
|
3276
|
|
POST
|
What type of field is "date_issued"? In your first post, it looks like it's a date field. If that's so, then you can't use a string to query it or to put in the result ('20240109A'). I successfully tested my code on a string field.
... View more
01-09-2024
09:06 AM
|
0
|
2
|
3285
|
| Title | Kudos | Posted |
|---|---|---|
| 3 | a week 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
|