POST
|
Hi @RaimonReventós , Almost a year ago I posted an idea (internally) with the title "Provide the location clicked in the pop-up to the Arcade expression". However, the idea is still open...
... View more
07-27-2022
02:21 PM
|
1
|
1
|
1038
|
DOC
|
Hi @Vanilla2020 , Have a look at the "GetFieldNamesOnPrivacy" function below: 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 GetFieldNamesOnPrivacy(f) {
// privacy_level with values from 0 to 5)
// I want to display, say field_A, field_B, field_C, field_D
// for locations with privacy level larger than 2,
// while only field_A and field_B
var fldlst = [];
var level = f["privacy_level"];
if (level > 2) {
fldlst = ["field_A", "field_B"];
} else {
fldlst = ["field_A", "field_B", "field_C", "field_D"];
}
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 = GetFieldNamesOnPrivacy(f);
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
}
... View more
07-27-2022
02:16 PM
|
0
|
0
|
6672
|
POST
|
Hi @AdamGebhart , I am glad that @KenBuja shared a good solution. Apart from the solution provided by Ken, there are many ways to do this. You can compare by exact date and time (probably the date has a time like 6 pm since it is stored as UTC date time and there is a difference between your local time zone and UTC): if ($feature.StatusDate == Date(2022, 11, 31, 18, 0, 0)) { ... } Another way (when the time does not matter) is to translate it to text and compare it as a string: if (Text($feature.StatusDate, "M/D/YY") == "12/31/22") { ... }
... View more
06-21-2022
01:27 PM
|
2
|
1
|
536
|
DOC
|
Hi @jschuckert , Good question... The FeatureSetByRelationshipName function is available in ArcGIS Online, but was not available in ArcGIS Enterprise at version 10.5.1. This might make the request to the server invalid or perhaps the response is not getting through correctly. Have you verified if there is something in the logs of ArcGIS Server?
... View more
06-21-2022
10:27 AM
|
0
|
0
|
3575
|
DOC
|
Hi @VanessaSimps , The comment above your comment explains just how to do that using the new Map Viewer and Arcade elements. Let me know if you have any questions on how to do this.
... View more
06-21-2022
10:14 AM
|
0
|
0
|
6927
|
POST
|
Hi @FredIausly1 , When I test with the TimeStamp() and Now() functions they return different results. The TimeStamp() will return the current date-time in UTC and Now() will return the current date-time in my Local time zone. You can use the ToLocal() and ToUTC() functions to switch between the time zones, but there is no function to automatically change to another time zone that is not UTC or Local. Be aware that the ToLocal and ToUTC functions will simply add or extract the number of hours difference between UTC and Local time zone indifferent is you provide a UTC or Local time. Also, in ArcGIS Online, date-time is stored in UTC and when you manually create a date it will be assumed to be in UTC. You can however use the DateAdd() function and add or subtract the number of hours to obtain the date-time in another time zone, but you should account for Daylight Saving Time depending on the date.
... View more
06-21-2022
10:12 AM
|
0
|
1
|
1314
|
POST
|
Hi @OliverSandoval_p , Sorry for the delay, but when I look at the distances that you get I wonder how big your feature is... Distances of 65M feet are about halfway around the globe. If I use Infinity or the searchDist as the initial minimum distance it will return the same result:
... View more
06-03-2022
10:41 AM
|
0
|
1
|
846
|
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
|
6603
|
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
|
491
|
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
|
801
|
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
|
7258
|
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
|
818
|
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
|
833
|
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
|
2494
|
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
|
354
|
Title | Kudos | Posted |
---|---|---|
1 | 11-12-2017 02:40 PM | |
1 | 11-14-2013 10:56 PM | |
1 | 05-22-2019 01:11 PM | |
1 | 06-28-2019 02:45 PM | |
1 | 07-27-2022 02:21 PM |
Online Status |
Offline
|
Date Last Visited |
a month ago
|