|
POST
|
Hi @DanielHoffman73 , In addition to what @KenBuja mentioned, it is advised that you use fields that contain underscores in a different way. See the corrected code below: if ($feature["Projected_Date_to_Open"] >= Date(2019, 6, 1) && $feature["Projected_Date_to_Open"] <= Date(2020, 5, 30)) {
return 'FY 19/20';
} else if ($feature["Projected_Date_to_Open"] >= Date(2020, 6, 1) && $feature["Projected_Date_to_Open"] <= Date(2021, 5, 30)) {
return 'FY 20/21';
} else if ($feature["Projected_Date_to_Open"] >= Date(2021, 6, 1) && $feature["Projected_Date_to_Open"] <= Date(2022, 5, 30)) {
return 'FY 21/22';
} else {
return 'N/A';
}
... View more
02-11-2021
06:30 AM
|
2
|
0
|
5160
|
|
POST
|
Hi @kirken , @KenBuja answered your first question indicating that the month is 0 based (November would be represented by 10) For the second question, I notice a couple of things. The Year, Month, and Day functions according to the documentation require a date to extract these values. You provide a string. Also, you used the names of functions for your variables and you should be careful about that. The fact that you got a result baffles me a bit, but I would not recommend taking this road. If you have a text that represents a date, you will probably have to extract the different parts, convert them to numbers and then provide these numbers to the Date function correcting the month value for being 0-based. var datetext = '20201102';
var y = Number(Left(datetext, 4));
var m = Number(Mid(datetext, 4, 2));
var d = Number(Right(datetext, 2));
Console(y);
Console(m);
Console(d);
return Date(y, m-1, d); Unfortunately, Arcade does not have a strptime() function like in Python which can convert a string to date using a provided patterns... (and yes @DanPatterson in Python this would be a lot easier).
... View more
02-11-2021
06:20 AM
|
4
|
1
|
4295
|
|
POST
|
Hi @DougBrowning , Field Maps already provides conditional visualization of fields using Arcade expressions as shown above. The same behaviour can be seen when opening the map in the Beta Map Viewer (if it is not there yet, it will be soon). What I am wondering is if you want to show a text (not a field) in the form (just as you can in Survey123)? I hope you won't add additional fields with text in order to mimic this behaviour, because I don't think that is the way to go.
... View more
02-11-2021
05:28 AM
|
0
|
2
|
2619
|
|
POST
|
Hi @AndyYang Thanks for explaining and I noticed the image you shared below. I see why it is important to be able to rotate the labels. The Beta Map Viewer allows you to rotate the map, but to align the map rotation so that a single label aligns with the related line is not something that will work.
... View more
02-10-2021
01:15 PM
|
0
|
1
|
5968
|
|
POST
|
Hi @AndyYang , I am sorry to tell you that I have no influence on the order of items on the backlog. I agree that it would be great to be able to rotate labels in the web map. What is your specific use case?
... View more
02-10-2021
12:31 PM
|
0
|
4
|
5973
|
|
POST
|
Hi @DougBrowning , It is not entirely clear to me why you want to add text to the form. Does this include an explanation about what needs to be done? Field Maps can show custom HTML in the pop-up (as far as I know). You can use divs to group information and use an expression to define the visibility in HTML. To show certain fields depending on the situation is something that can be done with Field Maps. You can create a group and apply conditional visualization on a group of fields or on the field level: See below the simple expression used in this case to hide fields that requires the user to specify the problem in case no problem was detected in the field. And this is how ArcGIS Field Maps will present the form depending on the situation. Specify the details: ... or not...
... View more
02-08-2021
09:40 AM
|
0
|
0
|
2654
|
|
POST
|
Hi @LorindaGilbert , From what I understand you have geometry stored in SQL Server and you want to access the area property of the geometry. In Arcade you can access attributes of features as mentioned by Josh or use the Area (https://developers.arcgis.com/arcade/function-reference/geometry_functions/#area ) or AreaGeodetic (https://developers.arcgis.com/arcade/function-reference/geometry_functions/#areageodetic ) functions to return the area of a geometry or feature. Be aware, since the precision of these functions depends on the view scale.
... View more
02-05-2021
11:43 AM
|
0
|
0
|
3181
|
|
POST
|
Hi @SarahHartholt , You are welcome. To take it a step further and include the validation to see if the main is contained by a buffer of the roads, have a look at this example: Function IsContainedByRoads(watermain, roads) {
var bufs = [];
// create list of selected roads buffer
for (var road in roads) {
var buf = Buffer(road, 10, 'meter');
bufs[Count(bufs)] = buf;
}
// union the road buffers
var buftot = Union(bufs);
// validate if watermain is contained by total buffer
return Contains(buftot, watermain);
}
//On Insert or Update populate Coordinate ID
var fsRoads = FeatureSetByName($datastore, "Centreline_Assets", ["Coordinated_ID"], True);
var watermain = $feature;
var watermainbuf = Buffer(watermain, 10, 'meter');
var roads = Intersects(fsRoads, watermainbuf);
var cnt = Count(roads);
// check different situations
if (cnt == 0) {
// there are no roads found
return null;
} else if (cnt == 1) {
// there is a one road, validate if the main is contained by the roads buffer
if (IsContainedByRoads(watermain, roads)) {
return First(roads)["Coordinated_ID"]; // create the ID using NextSequenceValue
} else {
// what to return when the main is not contained?
return null;
}
} else {
// there are multiple roads found, validate if the main is contained by the roads
if (IsContainedByRoads(watermain, roads)) {
//find the longest segment
var maxsegmentlength = 0;
var CoordID = null;
for (var road in roads) {
var segment = Intersection(road, watermainbuf);
var segmentlength = Length(segment, 'meter');
if (segmentlength > maxsegmentlength) {
CoordID = road["Coordinated_ID"];
maxsegmentlength = segmentlength;
}
}
return CoordID; // create the ID using NextSequenceValue
} else {
// what to return when the main is not contained?
return null;
}
}
... View more
02-04-2021
08:44 AM
|
1
|
0
|
1702
|
|
POST
|
Hi @SarahHartholt , Just go to your featureclass in the catalog window, right click, choose Manage and you will see the option Add GlobalID's
... View more
02-04-2021
08:19 AM
|
1
|
2
|
1707
|
|
POST
|
Hi @SarahHartholt I would recommend you to create an expression in the pop-up of the waterline layer and test the expression divided into parts. First until determining the count and return that count and then the other parts.
... View more
02-04-2021
07:23 AM
|
1
|
0
|
1715
|
|
POST
|
Hi @SarahHartholt , Good catch, it should indeed be "roads". I wonder why the general function failure is happening. The general function failure closed your ArcGIS Pro session? What version are you using? Where are the centerlines and water mains stored (they should be in the same $datastore)? Would it be possible to share a small piece of data to do some testing?
... View more
02-04-2021
06:38 AM
|
0
|
1
|
1725
|
|
POST
|
Hi @SarahHartholt , Since you are editing the same layer of the feature the return type does not have to be the object including the name of the featureclass. Have a look at the example below (without using NextSequenceValue): //On Insert or Update populate Coordinate ID
var fsRoads = FeatureSetByName($datastore, "Centreline_Assets",["Coordinated_ID"], True);
var watermain = $feature;
var watermainbuf = Buffer(watermain, 10, 'meter');
var roads = Intersects(fsRoads, watermainbuf);
var cnt = Count(RoadIntersect);
// check different situations
if (cnt == 0) {
// there are no roads found
return null;
} else if (cnt == 1) {
// there is a one road, return the Coordinate_ID
return First(roads)["Coordinated_ID"];
} else {
// there are multiple roads found, find the longest segment
var maxsegmentlength = 0;
var CoordID = null;
for (var road in roads) {
var segment = Intersection(road, watermainbuf);
var segmentlength = Length(segment, 'meter');
if (segmentlength > maxsegmentlength) {
CoordID = road["Coordinated_ID"];
maxsegmentlength = segmentlength;
}
}
return CoordID;
}
... View more
02-04-2021
06:10 AM
|
0
|
3
|
3638
|
|
POST
|
Hi @SarahHartholt , I think this is something that can be done. You can intersect the waterline buffer with the roads and evaluate the length of the road inside the buffer and take the Coordinate_ID of the longest road segment. I do have a couple of questions: Do you want to do this as a Batch or as an immediate calculation triggered by an edit? How will you handle waterlines that are not contained by the roadbuffer in your screenshot? Should these get the Coordinate_ID of the road it crosses or no Coordinate_ID?
... View more
02-04-2021
05:41 AM
|
0
|
5
|
3640
|
|
POST
|
Hi @SarahHartholt , I agree that debugging attribute rules is a bit tricky. However, you could use part of the expression in a pop-up to validate the result. You cannot use a return type that writes to a featureclass, but at least you will be able to see if the logic that occurs before returning the result is working. Using the playground is great to check functions and logic, but you won't have access to your data and the sample data provided is very limited (2 polygon layers). Related to the specific problem you are trying to tackle, there might be some additional complications since I suppose a waterline could intersect with multiple road buffers. When you create an attribute rule on your waterlines, you will want to read the current waterline feature and buffer it and intersect the buffer with the road features. Then (maybe) you would have to check the length of the road segments inside the waterline buffer, to see which Coordinated_ID you should take.
... View more
02-04-2021
05:11 AM
|
0
|
1
|
3643
|
|
POST
|
Hi @SarahHartholt , The error is pointing to line 4 and it is because you can't buffer a featureset, you can only buffer and single feature.
... View more
02-03-2021
02:32 PM
|
1
|
3
|
3650
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-09-2020 09:26 AM | |
| 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 |
| Online Status |
Offline
|
| Date Last Visited |
11-26-2025
02:43 PM
|