|
POST
|
The expression returns "block" or "none". These strings are used to show (block) or hide (none) the element in the popup's HTML code. To get what you want, you'll have to create a new expression that returns the inverse of the expression you have (just switch the return values in the IIf function). You can then create a new HTML element before Survey A: <div style="display:{expression/show_message};">You have not submitted your field information survey yet.</div>
<div style="display:{expression/show_survey_a};">...</div>
<div style="display:{expression/show_survey_b};">...</div> This solution is for Map Viewer Classic. If you're working with the current Map Viewer, you can also use an Arcade element, do all your decisions in there and return the HTML code.
... View more
06-09-2023
10:25 AM
|
0
|
1
|
4938
|
|
POST
|
Good catch, but this site would be riddled with semi-correct answers if I did this on purpose 😅 It was probably a copy/paste issue, I fixed it. Glad you got it to work!
... View more
06-09-2023
10:15 AM
|
0
|
0
|
1410
|
|
POST
|
Yes, it is because of null values. To fix it, you can insert this after line 7 to ignore features with null values in either field: fs = Filter(fs, "LGA IS NOT NULL AND Activity IS NOT NULL")
... View more
05-25-2023
11:21 PM
|
1
|
1
|
1960
|
|
POST
|
Export your table to a gdb and run either the Field Calculator or the script on that exported table. If the errors persist, I'm absolutely out of ideas.
... View more
05-25-2023
02:26 PM
|
0
|
1
|
1341
|
|
POST
|
var seg = $feature.SEG_ID
var addr = Filter(FeaturesetByName($datastore, "Address_fc", ["STNO", "SEG_ID", "SIDE_OF_RD"], false), "SEG_ID = @seg")
var left_addr = Filter(addr, "SIDE_OF_RD = 'Left'")
var right_addr = Filter(addr, "SIDE_OF_RD = 'Right'")
return{
result: {attributes: {
FROMLEFT: Min(left_addr, "STNO"),
TOLEFT: Max(left_addr, "STNO"),
FROMRIGHT: Min(right_addr, "STNO"),
TORIGHT: Max(right_addr, "STNO"),
}}
}
... View more
05-25-2023
01:00 PM
|
1
|
2
|
1454
|
|
POST
|
I have no idea why this is happening... Try doing it with a Python script instead (not in the Field Calculator, in the Python Window): table = "TestPolygons" # the table path or layer name
sort_field = "DateField1" # the sort field
number_field = "IntegerField1" # the field that will be calculated
i = 1
with arcpy.da.UpdateCursor(table, [number_field], sql_clause=[None, "ORDER BY {}".format(sort_field)]) as cursor:
for row in cursor:
row[0] = i
cursor.updateRow(row)
i += 1
... View more
05-25-2023
08:38 AM
|
0
|
3
|
3624
|
|
POST
|
But this is for ArcGIS Pro, and I didn't realize that you posted this question in the ArcMap group. If you're working with ArcMap, it's much easier to do this task with a little Python script. Open your Python Window Paste in this script, edit the first three lines and execute (hit Enter). table = "TestPolygons" # the table path or layer name
text_field = "TextField1" # the sort field
number_field = "IntegerField1" # the field that will be calculated
i = 1
with arcpy.da.UpdateCursor(table, [text_field, number_field], sql_clause=[None, "ORDER BY {}".format(text_field)]) as cursor:
for row in cursor:
row[1] = i
cursor.updateRow(row)
i += 1
... View more
05-25-2023
08:27 AM
|
1
|
0
|
1535
|
|
POST
|
Switch language to Arcade, use this expression (change "TextField1" to the name of your field): var oid = $feature.OBJECTID
var txt = $feature.TextField1
var previous = Filter($featureset, "TextField1 < @txt")
var same_lower = Filter($featureset, "TextField1 = @txt AND OBJECTID < @oid")
return Count(previous) + Count(same_lower) + 1
... View more
05-25-2023
04:26 AM
|
0
|
2
|
1549
|
|
POST
|
The behavior you want isn't that simple... Your two rules influence each other. The first rule looks at the field that gets changed by the second rule and vice versa. It might be better to do it in one rule: // Calculation Attribute RUle
// field: empty!
// triggers: update
var lifecycle = $feature.TextField1
var old_lifecycle = $originalfeature.TextField1
var retire_date = $feature.DateField1
var old_retire_date = $originalfeature.DateField1
// Was the date changed to a non-null value?
var abandon_feature = retire_date != null && retire_date != old_retire_date
// Was the lifecycle changed to "ABANDONED"?
var feature_was_abandoned = lifecycle == "ABANDONED" && lifecycle != old_lifecycle
// Calculate the new values
var new_retire_date = When(
abandon_feature, retire_date, // the date was changed by the user, use that value
feature_was_abandoned, Date(), // the lifecycle was changed to "ABANDONED", use current date
lifecycle != "ABANDONED", null, // the feature is not abandoned, set the date to null
retire_date // the feature is abandoned, some other field was updated, use existing value
)
var new_lifecycle = IIf(
abandon_feature, "ABANDONED", // the date was changed by the user, abandon the feature
lifecycle // some other field was updated, use the existing value
)
return {
result: {attributes: {
DateField1: new_retire_date,
TextField1: new_lifecycle
}}
} Change the field names in lines 5-8 and 31-32.
... View more
05-25-2023
04:16 AM
|
0
|
1
|
2070
|
|
POST
|
My guess is that your in_table is a layer that has a selection?
... View more
05-25-2023
03:14 AM
|
0
|
2
|
6252
|
|
POST
|
Correct. In the first rule in line 13, I specify that the OutrunNumber should only be copied to conductors. If you want other line assets to have the OutrunNumber, too, include them in that Filter(). In the second rule in line 12, I exclude switches from the targets, because that's where the OutrunNumber comes from. We don't want to overwrite that... If you want to exclude other point assets (or only want to include certain asset types), do it in that Filter().
... View more
05-25-2023
03:04 AM
|
0
|
0
|
2464
|
|
POST
|
var sd = $feature.DateField1
var oid = $feature.OBJECTID
var previous = Filter($featureset, "DateField1 < @SD")
var same_lower = Filter($featureset, "DateField1 = @SD AND OBJECTID < @oid")
return Count(previous) + Count(same_lower) + 1
... View more
05-24-2023
12:25 PM
|
0
|
8
|
3664
|
|
POST
|
In that case, I believe you're stuck with creating the filter in the widget.
... View more
05-24-2023
12:10 PM
|
0
|
0
|
5788
|
|
POST
|
This should work as long as you don't have exactly the same dates in multiple rows: var sd = $feature.SampleDate
return Count(Filter($featureset, "SampleDate < @SD")) + 1
... View more
05-24-2023
12:06 PM
|
0
|
11
|
3677
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-30-2023 09:57 AM | |
| 1 | 05-18-2023 12:51 AM | |
| 1 | 03-05-2023 12:46 PM | |
| 1 | 12-07-2022 07:01 AM | |
| 1 | 06-21-2022 08:27 AM |
| Online Status |
Offline
|
| Date Last Visited |
02-03-2024
06:14 PM
|