Hot answers tagged

4

An alternative approach that keeps it in ModelBuilder is this simple model: My example input data is: My model is: Summary stats tool is set up as: The Calculate field is set up as shown below: The model generates the following output table:


3

If you dont want pandas you can use collections.defaultdict(list) to group ids. Each row is read using da.SearchCursor and stored in a dictionary. import arcpy from collections import defaultdict fc = r'C:\data.gdb\somefc' datefield = 'DATE' groupfield = 'GROUP' #Create dictionary d = defaultdict(list) with arcpy.da.SearchCursor(fc,[groupfield,datefield]) ...


3

You could try using single quotes for the entire string with double quotes in the middle: '<a href="sample text">sample text</a>'


3

I've just done a quick test in ArcGIS Pro 2.1. A Find('text to find', 'text to search in', 0) seems to work. I've only tested on a handful of features, so I'm not sure what performance is like in a large dataset. var utility = $feature.UTILITY_GROUP; if (Find('E', utility, 0) > 0) { return 'electric' }; if (Find('G', utility, 0) > 0) { return '...


3

You must test IsEmpty for each value. You may try this code using the Labeling Profile at the Arcade Playground //Array to hold values and an index var i = 0; var features = []; //Add value to array if not empty function addvalue(feat) { if (!IsEmpty(feat)) { features[i++] = feat; } } //Add your values addvalue($feature.name1); addvalue(...


3

The Answer was to create a specific Arcade Expression per "Value" that I wanted and identify each expression in the pop-up config with a different color text. Expression 0: IIf($feature.status=='completed', 'completed', '') Expression 1: IIf($feature.status=='under construction’, 'under construction', '') Expression 2: IIf($feature.status=='in design', 'in ...


3

Attribute Expressions are just Arcade expressions that run with the JavaScript of the page, and have nothing to do with the actual data. For instance, when a popup loads with an Attribute Expression, the Arcade simply tells the popup to add another item which is the value from an operation against the data fields. The value (in your case, sum of two fields)...


2

You can try this http://www.arcgis.com/home/webmap/viewer.html?webmap=93bca1dfa0d14676adbefe160c7a8c3b //check the id for null values IF (isEmpty($feature.id)) { //id is null check the type When($feature.type == 'Male', "Male with no ID", $feature.type == 'Female', 'Female with no ID', "Other") } else { //id is good check the ...


2

The only way I could see doing it is to add an argument in your function for the field name. You have to add it manually to each addvalue call function addvalue(feat, field) { if (feat == 'Yes') { features[i++] = field; } } addvalue($feature.schoolCommGardenQuarter, "schoolCommGardenQuarter");


2

I believe this line: IIF($feature["YEAR_BUILT"]=="0", "No Data", "The building was built on $feature["YEAR_BUILT"].") needs to be: IIF($feature["YEAR_BUILT"]=="0", "No Data", "The building was built on " + $feature["YEAR_BUILT"] + ".")


2

I ended up using the "TextFormatting.DoubleQuote" function in arcade in order to accomplish this. var PhoneNumber = "915555555555" "<a href=tel:" + TextFormatting.DoubleQuote + PhoneNumber + TextFormatting.DoubleQuote + ">" + PhoneNumber + "</a>" Source: https://developers.arcgis.com/arcade/function-reference/constants/


2

In your symbology pane, click the hamburger icon in the top-right corner and select Advanced In the advanced symbology settings pane uncheck "Pad with zeros", and then click the back arrow. Your labels should now be without all the extra decimal places. The default number of decimal places appears to be 6. If you do still want to see some decimals, but ...


2

For those wanting looking for an expression builder reference there isn't one, what you need is the language reference: https://developers.arcgis.com/arcade/function-reference/. This doesn't give the whole story away as you have to click through the links to discover that you can call geometry($feature).x and geometry($feature).y. The following works for ...


2

I think you should be able to use nested iif statements to label your data the way you want. Something along these lines should work: iif($feature.price < 1000, "$" + $feature.price, iif($feature.price < 1000000, "$" + $feature.price/1000 + "K", iif($feature.price < 1000000000, "$" + $feature.price/1000000, ""))) With this statement, prices below ...


1

I have a couple of suggestions. First, I think the expression can be simplified to the following: function formatValue(value){ return When ( value >= 1000000, Text((value / 1000000), "$##.#m"), value >= 100000, Text((value / 1000), "$##.#k"), value >= 1000, Text((value / 1000), "$#.#k"), Text(value, "$#.#0") ); } formatValue($...


1

If you are labelling a feature which has a Domain on the field then this appears to be automatic in ArcGIS Pro, you see the description not the code. The function is DomainName() and has the syntax DomainName($feature, 'grade') where the second parameter is the field name. To see the actual code value I would reduce the expression to $feature.grade.


1

I think the short answer is no. If you search the geonet forum there is much debate about lack of support in the Arcade language for labelling in Collector and colouring of fonts. I would imagine this functionality will come in some future release.


1

First check for a space in the address usually the numbers are first, then check if the fist split is number or string them do stuff accordingly I wrote something short and tested in ESRI playground. var str = '1234 N. Street Name' var index=Find(' ', str , 0) var nfirstSplit = Number(Split(str,' ')[0]) var tfirstSplit = Text(nfirstSplit) IIf(index>0, ...


1

You're right, this would require an Arcade expression. The particular function you're looking for is IsEmpty(). This function will output either true or false, depending on whether the field is empty. Combining that with a logical and operator will accomplish what you want. To use it in reference to two layers, do the following: Open up the symbology menu ...


1

I found my answer below. //This Arcade expression is used to show only the features that contains a Domain value of "Active" when there are multiple fields that contain the same Domain. var StatusArray = [DomainName($feature,"phase1"), DomainName($feature,"phase2"), DomainName($feature,"phase3")] Boolean(IndexOf (StatusArray, 'Active') >= 0)


1

Instead of the IIf/Contains try using Intersects(). Its hard to know for sure without having the data to test on but give something like this a try. I modified this from one of the examples here. var centroids = FeatureSetByName($map,"centroid_values") var centroids_int = Intersects(centroids, $feature); //gets centroids contained by grid cell var cnt = ...


1

Though not documented, it appears that Arcade geometry is not supported for Map Image Services, only Feature services. This is unfortunate since map image services is where i would most often want to use custom popups for majority of users whereas we use feature services when higher level users edit and create data and in those web maps we do not use popups.


1

Try this var started = $feature.StartTime var closed = $feature.EndTime var present = Now() // if current date/time is greater than or equal to the start time // AND current date/time is less than or equal to the close time // return open, otherwise its closed If (present >= started && present <= closed) { return "Open" } else { ...


1

If I understand your question, you can use FeatureSetBy* to get a reference to the lookup table and obtain the value you are interested from the other table through that reference. This functionality was added around pro 2.3.


1

I know that you can see the number of features selected per TOC layer on the selection tab, I do not know of any way to do so without using feature selection.


1

The 'Advanced' menu isn't available for Labels. Here's an expression that can be used for them using Round(): Round($feature.fc_field_name, 3) Round(value, numPlaces?) -> returns: Number Source: https://developers.arcgis.com/arcade/function-reference/math_functions/


1

One slight difference I used was in passing the field value back into the expression, rather than defining it as 'string': IIf($feature.status=='under construction’, $feature.status, '') IIf($feature.status=='completed’, $feature.status, '') IIf($feature.status=='in design’, $feature.status, '') This works really well for non-string values as well, ex. $...


Only top voted, non community-wiki answers of a minimum length are eligible