|
POST
|
Hi @NCESOpen_Data , Sorry for the delay. In your case you can use something like: var txt = $feature["Your text field"];
if (Lower(txt) != 'unavailable') {
txt = Left(txt, Count(txt)-4);
}
return txt; A small example: var list = ['New Orleans, LA', 'Unavailable', 'Redlands, CA', 'Manhattan, NY'];
for (var i in list) {
var txt = list[i];
if (Lower(txt) != 'unavailable') {
txt = Left(txt, Count(txt)-4);
}
Console(txt);
} This will write to the console: New Orleans
Unavailable
Redlands
Manhattan
... View more
05-24-2022
03:43 PM
|
0
|
0
|
17254
|
|
POST
|
Hi @ArmstKP , I am not sure, so I can't confirm, but based on what you are seeing I can imagine that there are restrictions with this datasource.
... View more
05-10-2022
09:23 AM
|
0
|
0
|
1338
|
|
POST
|
Hi @SSMGroup , ArcGIS Dashboards in ArcGIS Online is also updated with each update of ArcGIS Online: https://www.esri.com/arcgis-blog/?s=#what's%20new&products=ops-dashboard
... View more
05-02-2022
09:09 AM
|
0
|
0
|
2044
|
|
DOC
|
Hi @erica_poisson , Yes, you can when you use the new Map Viewer. In this case, you will not add an expression (virtual field) to the pop-up, but you will add an Arcade Element and configure something like: Function HasDomain(f, fldname) {
return Domain(f, fldname) != Null;
}
Function GetAlias(f, fldname) {
var esquema = Schema(f);
var flds = esquema["fields"];
for (var i in flds) {
var fldinfo = flds[i];
if (fldinfo["name"]==fldname) {
return fldinfo["alias"];
}
}
return fldname;
}
Function GetFieldNames(f, excludeflds) {
var fldlst = [];
var esquema = Schema(f);
var flds = esquema["fields"];
for (var i in flds) {
var fldinfo = flds[i];
// Console(fldinfo["name"]);
// Console(Includes(excludeflds, fldinfo["name"]));
if (!Includes(excludeflds, fldinfo["name"])) {
Push(fldlst, fldinfo["name"]);
}
}
Console(fldlst)
return fldlst;
}
var fs = FeatureSetByName($datastore, "_8_de_formulario");
var oid = $feature.objectid;
var sql = "OBJECTID = @oid";
var f = First(Filter(fs, sql));
var excludeflds = ['globalid', 'objectid', 'prueba', "x_coord","y_coord","EditDate","Editor"];
var flds = GetFieldNames(f, excludeflds);
var info = [];
var atts = {};
for (var i in flds) {
var fldname = flds[i];
if (!IsEmpty(f[fldname])) {
var alias = GetAlias(f, fldname);
Push (info, {'fieldName': alias})
if (HasDomain(f, fldname)) {
atts[alias] = DomainName(f, fldname);
} else {
atts[alias] = f[fldname];
}
}
}
return {
type: 'fields',
title: 'Detalles de la actividad',
description : '(con Arcade)',
fieldInfos: info,
attributes : atts
} In this case, I have a feature service that stores the results of a Survey with a lot of conditional questions. In order to avoid the empty (non-relevant) fields being showed in the pop-up, you can use this to only show those that have information. On line 33 you define the layer that you want to connect to and on line 37 I define a list of fields that I don't want to show.
... View more
05-02-2022
09:05 AM
|
0
|
0
|
15036
|
|
POST
|
HI @SSMGroup , ArcGIS Online is updated 4 times every years. To have a look at what has been updated in each version I recommend the blogs: https://www.esri.com/arcgis-blog/?s=#What%27s%20new%20arcgis%20online&products=arcgis-online There are also videos available on the ArcGIS Channel: https://www.youtube.com/playlist?list=PLGZUzt4E4O2IulSSoNHnpaprsxhbWPa3B The documentation will normally reflect the changes in the latest version: https://doc.arcgis.com/en/arcgis-online/reference/whats-new.htm
... View more
05-02-2022
08:56 AM
|
0
|
1
|
2061
|
|
POST
|
Hi @EfeUngun , A couple of thoughts on the subject. There is a ISOWeekday function: Returns the day of the week of the given date, based on the ISO 8601 standard. Values range from 1-7 where Monday is 1 and Sunday is 7. However, if you believe that statistics are shifted, it might be good to have a look at the data and especially the dates. Normally dates are stored in UTC time and when working with dates it will take into account your timezone to work with the dates correctly. If the data was loaded into a featureservice this might be something to validate. It is possible to use ToLocal or ToUTC functions to alter the date (or a personalized DateAdd function) before creating the statistics but it takes some validation to be sure that the outcome is correct.
... View more
04-27-2022
02:32 PM
|
0
|
0
|
1740
|
|
POST
|
Hi @DanielShaffer2 , Just to clarify: "Your code examples above work great for Popups, but not within the Change Style dialogs. (OrderBy, Filter & FeatureSets are not available there). I was pretty much there already with popups." As I mentioned at the end of my previous response, the Arcade expression would be used in multiples Field Calculations and as you also confirmed will not be your first option. A scheduled Python Notebook is probably a lot better to accomplish the desired result. I recommend having a look at the path "Learn Python with ArcGIS Notebooks" Path: https://learn.arcgis.com/en/paths/learn-python-with-arcgis-notebooks/ , which should be available to you without cost. Here is an example of a Notebook that I have used in the past to update information in a featureset based on related data. # load libraries
from arcgis.gis import GIS
from copy import deepcopy
# create a connection to the active portal (AGOL)
gis = GIS("home")
# Item Added From Toolbar
# Title: ValvulasIBAL_v02 | Type: Feature Service | Owner: xbakker.spx
item = gis.content.get("00000000000000000000000000000000") # replace with your item ID
# I have a hosted service with one featureset and 1 table, that why I use 0 as index
flayer = item.layers[0]
tbl = item.tables[0]
print("features: {}".format(len(flayer.query(where="1=1"))))
print("records: {}".format(len(tbl.query(where="1=1"))))
# returns:
# - features: 58
# - records: 6
# function to determine the last state of the asset
def UltimoEstado(tbl, glob):
sql = "ParentGlobalID='{" + glob + "}'" # my query based in global ID
top_filter = {"topCount": 1, "orderByFields": "FechaCambio desc"} # filter definition, take top 1 when data is ordered by date (descending)
ts = tbl.query(where=sql, order_by_fields='FechaCambio DESC') # apply query to table
cnt = 0
estado = "Abierta" # if there is no related record, default to "Open" status for valve
if len(ts) > 0:
for row in ts:
if cnt == 0:
estado = row.attributes["EstadoValvula"] # read out the value from the field than contains the state of the asset
else:
# only take the first record for the most recent status
break
cnt += 1
return estado
# similar function to read out the last update date
def UltimaGestion(tbl, glob):
sql = "ParentGlobalID='{" + glob + "}'"
top_filter = {"topCount": 1, "orderByFields": "FechaCambio desc"}
ts = tbl.query(where=sql, order_by_fields='FechaCambio DESC')
cnt = 0
ultimagestion = None # if there is no related record, default date to None
if len(ts) > 0:
for row in ts:
if cnt == 0:
ultimagestion = row.attributes["FechaCambio"] # read out the value from the field than contains the date of the update
else:
# only take the first record for the most recent date
break
cnt += 1
return ultimagestion
# define a query to get all the features
fs = flayer.query(where="1=1")
# Loop to run through all the valves
actualizar_features = []
for feat in fs:
# read the globalID
glob = feat.attributes["GlobalID"]
# call the function llamar to get the last update from the related table (state and date)
estado = UltimoEstado(tbl, glob)
ultimagestion = UltimaGestion(tbl, glob)
# make a deep copy of the current feature
nuevo_feature = deepcopy(feat)
# update the values in the deepcopy
nuevo_feature.attributes['EstadoActual'] = estado
nuevo_feature.attributes['UltimaGestion'] = ultimagestion
# add the updated feature to a list
actualizar_features.append(nuevo_feature)
# update the featureset
flayer.edit_features(updates=actualizar_features) Make sure when you create a new notebook to select the "Standard" option to avoid unnecessary consumption of credits.
... View more
04-26-2022
03:53 PM
|
0
|
1
|
5752
|
|
POST
|
Hi @explocarto , The first screenshot that you showed is of an Arcade Data Expression and this is not using the Data Formatting profile which is limited in what it can do. So in short, I think it should be possible to do what you want to accomplish. Can you share some more details on what the data is and how you want to obtain the non-overlapping area?
... View more
04-20-2022
04:54 PM
|
0
|
0
|
942
|
|
POST
|
Hi @DanielShaffer2 , I extracted the data and published it to my organization to do some testing and wanted to provide a small example of what you could do with Arcade. For instance, I can extract the last measurement of the water temperature from the Chemistry table by doing this: var station = $feature["Station_Name"];
var sql = "Location = @station";
var tbl = OrderBy(Filter(FeatureSetByName($datastore,"Chemistry_Import", ["Location", "Water_Temp_C", "Collection_Date"]), sql), "Collection_Date DESC");
var cnt = Count(tbl);
var result = Null;
if (cnt > 0) {
var temp = First(tbl)["Water_Temp_C"];
result = temp;
}
return result; Or I can extract the date on which the latest temperature was measured, like this: var station = $feature["Station_Name"];
var sql = "Location = @station";
var tbl = OrderBy(Filter(FeatureSetByName($datastore,"Chemistry_Import", ["Location", "Water_Temp_C", "Collection_Date"]), sql), "Collection_Date DESC");
var cnt = Count(tbl);
var result = Null;
if (cnt > 0) {
var dt = First(tbl)["Collection_Date"];
result = dt;
}
return result; Or the count of the Chemistry samples at each location: var station = $feature["Station_Name"];
var sql = "Location = @station";
var tbl = Filter(FeatureSetByName($datastore,"Chemistry_Import", ["Location"]), sql);
var cnt = Count(tbl);
return cnt; Or do some statistics of getting the average temperature at each location: var station = $feature["Station_Name"];
var sql = "Location = @station";
var tbl = Filter(FeatureSetByName($datastore,"Chemistry_Import", ["Location", "Water_Temp_C"]), sql);
var cnt = Count(tbl);
var result = Null;
if (cnt > 0) {
var temp = Mean(tbl, "Water_Temp_C");
result = temp;
} Having the (aggregated) data at the feature level allows you to use multiple attributes for visualization, like the latest temperature and the number of samples: ... or the mean temperature versus the latest temperature: This method is probably not the best when you have a lot of information that needs to be updated (a lot of field calculations to perform). In that case, it might be better to create a Notebook and use Python to update the data. This way you can also create a scheduled task that will execute every defined interval to update the data without any manual intervention.
... View more
04-19-2022
04:04 PM
|
0
|
3
|
5772
|
|
POST
|
Hi @DanielShaffer2 , To do some testing I will need to extract some of your data from the map, republish the data in my portal and look at the possible scenarios to accomplish this. It may take some time to do this, but I will have a look at it.
... View more
04-19-2022
05:43 AM
|
0
|
0
|
5777
|
|
POST
|
Hi @MarcoConopio1 , The error is pointing to the use of a field that does not exist in the featureclass. Can you check that the fields with names assigned to the variables "fld_orden" and "fld_label" exist in your featureclass?
... View more
04-19-2022
05:41 AM
|
0
|
0
|
1590
|
|
BLOG
|
Hi @NicholasRutledge , As of the December 2021 update, there is a different way to create HTML content in the pop-up. There are some blogs on this topic by Paul Barker: https://www.esri.com/arcgis-blog/products/arcgis-online/mapping/part-1-introducing-arcade-pop-up-content-elements/ https://www.esri.com/arcgis-blog/products/arcgis-online/mapping/part-2-introducing-arcade-pop-up-content-elements/
... View more
04-18-2022
06:24 AM
|
0
|
0
|
3045
|
|
POST
|
Hi @AnneSanta_Maria1 , First of all thanks for sharing the sample data. This helped a lot to understand what you are after. Although I also answered your direct message, I wanted to share some thoughts on this challenge here available for the rest of the community too. When editing a point in ArcGIS Pro, the attribute rule defined on this point layer can have access to the values found in a different layer (like the rooms of a floor in a building). However, the way the attribute rule has access to the other layer is through the $datastore and the datastore is the source of the data and has no knowledge of what floor is currently visualized in a map. As I mentioned in my direct message, I believe the right way to go forward is to explore ArcGIS Indoors (https://www.esri.com/en-us/arcgis/products/arcgis-indoors/overview), since it comes with solutions to work with floors in a building and collect data for a specific location on a floor. An alternative solution in ArcGIS Pro, would be to approach this as a 3D problem. You can visualize your building in a local scene, define the base elevation (based on your elevation field), and if desired, the extrusion, based on the floor to floor height. Define a range slider based on the floor and visualize the floor where you want to create a 3D point. This will snap to the base elevation of the floor. You can use the Z value of the point to query the floor polygons and then use the Intersects function to intersect your point with the floor to obtain the room polygon. This allows you to use the information of the room directly for your point in an Attribute Rule. Below is the Attribute Rule I used: // get the building polygons
var building = FeatureSetByName($datastore, "Buildings_Room", ['BldRecNbr', 'Floor', 'RmRecNbr', 'RmNbr'], false);
// extract the z value of the 3D point and get a min and max value (z-1ft and z+1ft)
var z = Geometry($feature)["z"];
var zmin = z-1;
var zmax = z+1;
// create query on elevation using Z value of 3D point
var sql = "Elevation > @zmin AND Elevation < @zmax";
// filter building polygons to get floor polygons
var CurrentFloor = Filter(building, sql);
// do 2D intersection of feature with floor polygons
var intersectingrooms = Intersects(CurrentFloor, $feature);
// read out values
if (Count(intersectingrooms) > 0) {
var intersectingroom = First(intersectingrooms);
return{
"result" : {
"attributes": {
"BldRecNbr": Right(intersectingroom.BldRecNbr, 5),
"Floor": intersectingroom["Floor"],
"RmRecNbr": intersectingroom.RmRecNbr,
"RmNbr": intersectingroom.RmNbr
}
}
}
} ...and a visualization of the result:
... View more
04-12-2022
09:09 AM
|
0
|
0
|
3468
|
|
POST
|
Hi @CBarrett , Thanks for your support. You can find the link below: https://community.esri.com/t5/arcgis-online-internal-ideas/provide-the-location-clicked-in-the-pop-up-to-the/idi-p/1087588 (although this is an internal idea, and it might not be available to everyone)...
... View more
04-11-2022
01:35 PM
|
0
|
0
|
5313
|
|
POST
|
Hi @AnneSanta_Maria1 , That is an interesting case. I haven't played with that part but it somehow feels as if this should be possible. Would it be possible to get access to (a sample of) the data? Could you share this with me using my user "xbakker.spx"?
... View more
04-08-2022
02:18 PM
|
0
|
1
|
3484
|
| Title | Kudos | Posted |
|---|---|---|
| 6 | 12-20-2019 08:41 AM | |
| 1 | 01-21-2020 07:21 AM | |
| 2 | 01-30-2020 12:46 PM | |
| 1 | 05-30-2019 08:24 AM | |
| 1 | 05-29-2019 02:45 PM |
| Online Status |
Offline
|
| Date Last Visited |
2 weeks ago
|