|
POST
|
It is still a relatively new language that even I don't know why some things work and others don't. I also code in python and only started using arcade about a year ago, and I still don't understand why some things that work in other programming languages doesn't work in arcade. I also didn't realize that I made a mistake in one of the examples that I provided. You could have the field name variable used within the FeatureSetByName. That I know does work. I will need to update it to show that.
... View more
03-27-2024
04:25 AM
|
1
|
2
|
3785
|
|
POST
|
We are using 3.2 but we were told it won't work past 2.9.
... View more
03-26-2024
01:19 PM
|
0
|
1
|
3561
|
|
POST
|
The issues with this, that I have discovered, is there is a bug that ESRI is aware of where assigning the feature name to a variable will cause some issues. The FeatureSetByName is used to call an entire feature. With this you have to specify the exact name of the featureclass or table, otherwise it will result in an error when you try to run the code. The other thing is you have to include all fields that you want to check. I noticed that the "OBJECTID" field was missing which would also result in an error. It will check when running the code validation for errors but result in an error when ran. The Expects can be used on $featureset or $feature, but if used on $feature will only return values within that row/record. You will want to specify a $featureset in order to return all values within the specified table/featureclass. Give the code below a try and see if it works for you. // INPUTS
var fcName = "TEST"
var fldName = "Name_Text"
var OIDField = 'OBJECTID'
var Testing = $feature.Name_Text
// These two lines must be written with the actual strings, not the variables above.
Expects($featureset, OIDField , fldName )
for (var i in $featureset) {
if ((i[fldName] == Testing ) && (i[OIDField ] != $feature[OIDField ])) {
return {"errorMessage": "ERROR: value not unique within field!"}
}
}
// If error above not found, return results dict with value as-is.
var fldUpdates = { fldName : Testing }
Console({"result": {"attributes": fldUpdates}})
return {"result": {"attributes": fldUpdates}} If that code does not work you can try this one. // INPUTS
var fcName = "TEST"
var Testing = $feature.Name_Text
var OID = $feature.OBJECTID
var OIDField = "OBJECTID"
var NameField = "Name_Text"
// These two lines must be written with the actual strings, not the variables above.
var features = FeatureSetByName($datastore, "TEST", [OIDField , NameField ])
for (var i in features) {
if ((i[NameField] == Testing ) && (i[OIDField] != OID )) {
return {"errorMessage": "ERROR: value not unique within field!"}
}
}
// If error above not found, return results dict with value as-is.
var fldUpdates = { NameField : Testing }
var Result = {"result": {"attributes": fldUpdates}}
Console(Result )
return Result
... View more
03-26-2024
01:11 PM
|
1
|
4
|
3818
|
|
IDEA
|
Hi, I thought it would be really helpful if editor tracking for attribute rules could be added as additional functionality when attribute rules are created. One of the issues that I find, especially when troubleshooting attribute rules, is I get error messages in Field Maps stating invalid arcade expression. It doesn't tell me specifically which rule caused the issue nor can I identify which rule since there is no information regarding when and by whom the attribute rule was created or modified. I think that having the ability to identify when and whom made changes to the attribute rules would be really helpful in identifying when an attribute rule changed to make troubleshooting easier.
... View more
03-07-2024
06:09 AM
|
1
|
0
|
731
|
|
POST
|
Here is what I use which might be of some help. This function gets field names in a feature that are not in the list of omitted field names. If there isn't a list of field names to omit, include all field names. function GetFieldNames( InputFeature , OmitFields ){
var FieldNames = [ ]
var FeatureInfo = Schema(InputFeature).fields
for ( var i in FeatureInfo ){
// Get the field name of the input feature
var fieldname = FeatureInfo[ i ].name
if ( Boolean( OmitFields ) ) {
if ( Includes( OmitFields , fieldname ) == False ) { Push( FieldNames , fieldname ) }
}
else { Push( FieldNames , fieldname ) }
return FieldNames
} This function finds all matching field names between two features. // Get matching field names found in both lists
function GetMatchingFields( FieldListA, FieldListB ){
var MatchingFields = [ ]
// Loop through the list of field names in list A
for ( var i in FieldListA ){
var fieldname = FieldListA[i]
/* If list of field names in list B includes the field name in list A
then append the field name to the matching list of field names */
if ( Includes( FieldListB , fieldname ) ){ Push( MatchingFields, fieldname ) }
}
return MatchingFields
} This one gets all attributes from a feature based on input field names. // Get feature attributes based on field list
function GetFeatureAttributes( FieldList ){
Expects( $feature , '*' )
var Attributes = Dictionary( $feature ).attributes
var SpecificAttributes = { }
if ( IsEmpty( FieldList ) == False ){
for ( var f in FieldList ){
SpecificAttributes[ FieldList[ f ] ] = Attributes[ FieldList[ f ] ]
}
}
else { SpecificAttributes = Attributes }
return SpecificAttributes
} These may be of some use to you but I have used these to automate a lot of attribute rules. It also takes the guess work out of having to do things manually. You can also use the get matching field names function with the get field names function(s) as inputs. MatchingFieldNames = GetMatchingFields( GetFieldNames( InputFeature , OmitFields ), GetFieldNames( InputFeature , OmitFields ))
... View more
02-12-2024
12:56 PM
|
1
|
0
|
3634
|
|
POST
|
Hi @EMiller_2, Without knowing what the string looks like, it could be that the code is not set properly or there are other characters in the string that is preventing the character replacements. An option to fix this is: """Expression"""
Expression = NewString( Field or Value )
"""Code Block"""
def NewString( InsertString ):
New = None
if type( InsertString ) != str: pass
else:
if ',' in InsertString:
New = InsertString.split( ',' )
New = '_'.join( New )
else: pass
if New: return New
else: return
... View more
02-12-2024
12:20 PM
|
0
|
1
|
3076
|
|
IDEA
|
You can set to limit the map to only the extent of a specified shape within a map series, and you can also specify exceptions for displaying layers. This is set in the map properties. Or this option can be set within the map series setting.
... View more
01-25-2024
10:29 AM
|
0
|
0
|
3430
|
|
IDEA
|
Hi, I thought it would be a great idea if there was a way to create a custom rule repository for calculations for an organization. This would make it easier to be able to select specific rules rather than having to copy and paste or import a rule from another location.
... View more
01-10-2024
09:21 AM
|
0
|
0
|
645
|
|
IDEA
|
Hi, I would really like for additional attribute rule functionality to be able to retrieve matching fields, records etc. and to also have editing capabilities. Thus far most of those functionalities have to be scripted in but I was wondering if it could be set as a function rather than something that has to be scripted. // Get matching field names found in both lists
function GetMatchingFields( FieldListA, FieldListB ){
var MatchingFields = [ ]
// Loop through the list of field names in list A
for ( var i in FieldListA ){
var fieldname = FieldListA[i]
/* If list of field names in list B includes the field name in list A
then append the field name to the matching list of field names */
if ( Includes( FieldListB , fieldname ) ){ Push( MatchingFields, fieldname ) }
}
return MatchingFields
} // Get field names from input features
function GetFieldNames( InputFeature , OmitFields ){
var FieldNames = [ ]
var FeatureInfo = Schema(InputFeature).fields
for ( var i in FeatureInfo ){
// Get the field name of the input feature
var fieldname = FeatureInfo[ i ].name
if ( Boolean( OmitFields ) ) {
if ( Includes( OmitFields , fieldname ) == False ) { Push( FieldNames , fieldname ) }
}
else { Push( FieldNames , fieldname ) }
return FieldNames
} // Get feature attributes based on field list
function GetFeatureAttributes( FieldList ){
Expects( $feature , '*' )
var Attributes = Dictionary( $feature ).attributes
var SpecificAttributes = { }
if ( IsEmpty( FieldList ) == False ){
for ( var f in FieldList ){
SpecificAttributes[ FieldList[ f ] ] = Attributes[ FieldList[ f ] ]
}
}
else { SpecificAttributes = Attributes }
return SpecificAttributes
}
... View more
01-04-2024
06:40 AM
|
0
|
0
|
953
|
|
IDEA
|
You can change the order of rule by double clicking on the order number and typing in the order that you wish.
... View more
01-04-2024
05:51 AM
|
0
|
0
|
4263
|
|
IDEA
|
You can always change the order of a rule by simply double clicking on the order number and changing it manually to the desired order.
... View more
01-02-2024
01:05 PM
|
0
|
0
|
3803
|
|
POST
|
@brandonmann3 if ( A <= 7 && now() < $feature.start_closure ) else if ( B <= 7 && A > 7 && now() < $feature.end_closure ) OR var start = $feature.start_closure
var end = $feature.end_closure
var A = DateDiff(Now(), start , 'days' )
var B = DateDiff(Now(), end , 'days' )
var Condition = Null
if ( A <= 7 && start < now()){ Condition = "Active last week" }
else if ( B <= 7 && A > 7 && end < now() ){ Condition = "Ended Last Week" }
else { Condition = "Other" }
Console( Condition )
return Condition Insert either of the characters below in parentheses if you want to combine statements && is equal to 'AND' || is equal to 'OR'
... View more
01-02-2024
11:11 AM
|
1
|
1
|
3043
|
|
POST
|
Hi, Currently I encountered a bit of an issue regarding bulk editing where selected records get updated with the same date. Is there an arcade script that will change all of the dates by one second so that each date is unique. I don't know if there is a way to modify bulk edits on the same feature class but I am hoping there might be some solution(s) to this.
... View more
01-02-2024
07:08 AM
|
0
|
1
|
1438
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 2 weeks ago | |
| 1 | 05-07-2026 01:36 PM | |
| 1 | 02-10-2026 06:09 AM | |
| 1 | 03-04-2026 01:08 PM | |
| 1 | 02-24-2026 12:59 PM |
| Online Status |
Offline
|
| Date Last Visited |
Friday
|