|
POST
|
Hi @FPGIS_FrancescaRohr , Sorry for the delay, but I was in meetings all afternoon. I was looking at the expression and I can't see any problem with it. I assume as you do that it concerns the SQL. I think you are creating it correctly, but I can't validate without having access to the data. In case possible, can you share the data? You could create a group, share the data to that group and invite me using "xbakker.spx" to the group. Some minor changes to your expression, but none that will solve the issue. var inspections = FeatureSetByName($map, "UCF Tree Inspections - UCF Tree Inspections");
var treeuniqueid = $feature["Grant_ID"] + "_" + $feature["Tree_ID"];
var sql = "Tree_UniqueID = @treeuniqueid";
Console(sql);
var inspection = Filter(inspections, sql);
var cnt = Count(inspection);
var history = "";
if (cnt > 0) {
history = "inspection(s): " + cnt;
} else {
history = "No inspections";
}
return history;
... View more
05-13-2021
04:17 PM
|
0
|
0
|
2860
|
|
POST
|
Thanks @Anonymous User for jumping in. Will you get back when you know if the behaviour in Pro is indeed a bug? It would be nice to have a setting in ArcGIS Pro where the user can decide in what time zone he/she wants to see a date-time. Do you know if this is on the roadmap?
... View more
05-13-2021
04:08 PM
|
1
|
0
|
6612
|
|
POST
|
Hi @kshahmmp , I wish that was possible. Arcade would be able to extract whatever other features are beneath the feature the user clicked on, but this won't stop ArcGIS to consult the feature below and apply the same Arcade expression to see what other features it can find. This will come at a cost (performance) and you will still see the "1 of 2" and "2 of 2" (although in this case, the user would not have to go to the second feature to obtain the details.
... View more
05-13-2021
04:05 PM
|
0
|
0
|
13643
|
|
POST
|
Hi @FPGIS_FrancescaRohr , Quick question: does your data use a Relationshipclass? If so, you are probably better off using the "FeatureSetByRelationshipName" to get to the related records.
... View more
05-13-2021
10:50 AM
|
0
|
0
|
2864
|
|
POST
|
Hi @kmsmikrud , As far as I can see the $layer returns the entire featureset and does not take into account the current state of the layer (like filtered on a date-time range using the slider). It would be a great enhancement to have access to this "state" and being able to get a result taking into account that state. Are you willing to create an idea for this?
... View more
05-13-2021
07:01 AM
|
0
|
4
|
2515
|
|
POST
|
Hi @VHolubec , In a web map when calculating the local time using "ToLocal(Now())" would work and therefore I am a bit surprised why it still returns the UTC time when you do this. I just tested this and that's what happend. @Anonymous User any idea why? There is a tool that allows you to convert time between time zones (https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/convert-timezone.htm ) but to be honest the time zone selection is not very user friendly (for instance I couldn't find the Colombian time zone). Another way is using the DateAdd() function to manually change the time zone. I used this in my case: DateAdd($feature.DateTime, 7, 'hours') Now, there is something you need to keep in mind. If you live in a country with daylight savings, losing the reference to UTC might create errors in interpretations later on. There should be an option in the configuration that defines how you want to see the data times (in UTC or convert to local time zone). There are some options when you enable time on your layer, but if you don't want to do that, it should be possible to see the date and time as the user wants. @Anonymous User what are your ideas on this?
... View more
05-13-2021
06:32 AM
|
3
|
2
|
6634
|
|
POST
|
Hi @aroininen , If you look at my code you will see that the Sum is using "fs" (the filtered featureset) and not "sconnection" (the $layer). This is why it is not working for you.
... View more
05-12-2021
11:00 AM
|
0
|
1
|
2624
|
|
POST
|
Hi @aroininen , It is possible to apply a filter on the data. Have a look at the expression below. We define a SQL query (make sure you use a valid query and the correct field names). We use a Filter to apply the query and provide the filtered featureset to the sum functions. // make sure you use the extact field name
var sql = "ServiceArea IN (1,4,5,8,9)";
// filter the layer with the query
var fs = Filter($layer, sql);
// get the totals
var Canc = Sum(fs, "F_CanConne_1");
var Reserved = Sum(fs, "F_Reserved_1");
var DeswPro = Sum(fs, "F_DesWpro_1");
var Total = Canc + Reserved + DeswPro;
// structure the result
var result = "CanConnect: " + CanC;
result += TextFormatting.NewLine + "Reserved: " + Reserved;
result += TextFormatting.NewLine + "DeswPro: " + Deswpro;
result += TextFormatting.NewLine + "Total: " + Total;
// return the result
return result;
... View more
05-12-2021
10:09 AM
|
0
|
3
|
2630
|
|
POST
|
Hi @ZachBodenner , There is no need to use Arcade in this case. Just go into the configure pop-up option of the layer, there you will find the option "configure attributes" and in the window that appears you can change the alias of the field name:
... View more
05-11-2021
03:23 PM
|
0
|
0
|
1074
|
|
POST
|
Hi @aroininen , The first question would be to know if the feature you click on is part of the layer where you want to get the totals from (this would allow us to use $layer)? If not, is the layer in the map (you would probably use FeatureSetByName? If that is not the case, the way to access the layer will be a bit different using FeatureSetByPortalItem. The second question is, do you want to return 3 separate values and handle them as separate virtual fields (which would need an Arcade expression for each total) or is returning a text with the 3 totals what you are looking for? Have a look at the example below: // access the layer of the feature the user clicked on
var fs1 = $layer;
// access another layer that is available in the map
var fs2 = FeatureSetByName($map,"Parcels_And_Buildings - Tax Parcels")
// calculate the sum of floor count of the first featureset
var tot1 = Sum(fs1, "FLOORCOUNT");
// calculate the sum of the Residential Floor Area fom the seconf featureset
var tot2 = Sum(fs2, "RESFLRAREA");
// calculate the sum of the Building Area fom the seconf featureset
var tot3 = Sum(fs2, "BLDGAREA");
// create a string and append each total on a new line
var result = "Floorcount: " + tot1;
result += TextFormatting.NewLine + "Residential Floor Area: " + Round(tot2, 0);
result += TextFormatting.NewLine + "Building Area: " + Text(tot3, "000.000.000 m²");
// return the formatted text
return result; This will return a single text containing the 3 sums: Floorcount: 26405
Residential Floor Area: 133370425
Building Area: 397.900.000 m²
... View more
05-11-2021
03:16 PM
|
0
|
7
|
2642
|
|
POST
|
Hi @FPGIS_FrancescaRohr , The problem, in this case, is that you are returning a featureset to the pop-up. That is something the pop-up can't visualize. It does show in the expression builder, but this does not mean that it will show in the pop-up. You will probably have to loop through the features in the featureset and construct the text that you want to return. Have a look at https://community.esri.com/t5/arcgis-online-documents/using-featuresetby-functions-in-arcade-to-drill-down-to-other/ta-p/918691 and the second code block where a list of maintenances of a hydrant is formatted and returned to the pop-up.
... View more
05-11-2021
02:59 PM
|
0
|
2
|
2873
|
|
POST
|
Hi @DavidColey , The error "Warning, return type must be a number" occurs when you already have a category field selected and you are defining an expression. This expression will be used as the second field and must be numeric. I have had the same error and when I removed the field of the symbology with the cross "x" just above the "+ expression" it worked as expected. Sorry for the screenshot in Spanish...
... View more
05-11-2021
02:52 PM
|
1
|
1
|
1668
|
|
POST
|
Hi @erica_poisson , I assume that the date is passing as a string. I provided another above some code to pass the date as epoch which might work.
... View more
05-07-2021
11:06 AM
|
0
|
0
|
3274
|
|
POST
|
Hi @erica_poisson , I have a better idea. Can you try this: // settings
var p = 'https://www.arcgis.com';
var itemID_CMpts = 'xxx';
var layerID_CMpts = 0;
var relationshipName = "";
// access first featureset
var fs1 = Filter(FeatureSetByPortalItem(Portal(p), itemID_CMpts, layerID_CMpts, ['Point_Status', 'EQ_File_Number', 'Inspection_Date'], true), "Point_Status ='Unstable' AND EQ_File_Number In ('EQ2015-078', 'Eq2013-026', 'EQ2018-082', 'EQ2018-052', 'EQ2001-080X', 'EQ2003-021', 'EQ1989-015', 'EQ2002-023', 'EQ2002-045X', 'EQ2019-110', 'EQ2020-017', 'EQ2019-091', 'EQ2018-029', 'EQ2020-033', 'EQ2019-036', 'EQ2020-052', 'EQ2019-064', 'EQ2017-040', 'EQ2020-031', 'EQ2021-003', 'EQ2011-016', 'EQ2017-026', 'EQ2021-020')");
// create data schema
var Dict = {
'fields': [
{'name': 'EQNum', 'type': 'esriFieldTypeString'},
{'name': 'InspecDate', 'type': 'esriFieldTypeDate'},
{'name': 'PtStatus', 'type': 'esriFieldTypeString'}],
'geometryType': 'esriGeometryPoint',
"spatialReference": {
"wkid": 102100,
"latestWkid": 3857
},
'features':[]};
// analysis and fill Dict
var i = 0;
for (var f in fs1) {
var fs2 = FeatureSetByRelationshipName(f, relationshipName, ['Point_Status_revisit'], false);
var cnt = Count(fs2);
if (cnt == 0) {
Dict.features[i] = {
'geometry': {
'x': Geometry(f)["X"],
'y': Geometry(f)["Y"]
},
'attributes': {
'EQNum': f["EQ_File_Number"],
'InspecDate': DateDiff(f["Inspection_Date"], Date(1970, 0, 1, 0, 0, 0), "milliseconds"),
'PtStatus': f["Point_Status"]
}
};
i++;
}
}
Console(Text(Dict));
return FeatureSet(Text(Dict));
... View more
05-07-2021
11:04 AM
|
2
|
2
|
3275
|
|
POST
|
Hi @erica_poisson , I assume that despite the changes it is still not working right? I validated the json that is returned in json lint and it is valid. I have also stored the json in a file and used json 2 feature and it creates a valid featureclass with the features. The only thing that does not come through are the dates. Maybe it is expecting a value (epoch) rather than what it has at this moment. Could you do another test and change the output field type of the date to string. Just to see if that passes. If so we will focus on converting the date to epoch.
... View more
05-07-2021
10:56 AM
|
0
|
5
|
3276
|
| 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 |
11-26-2025
02:43 PM
|