|
POST
|
So far I'm totally stumped on getting any text functions to work ... everything I try to put into a string field just ends up writing the function name and parameters as a literal string, e.g. "CONCAT(v1,v2)" . I'm not sure whether there's a way around that. The same thing happens for me. I wonder if Esri (or an underlying mechanism) has intentionally disabled expressions for text fields for security reasons. Would there be SQL injection concerns? That's not something I know anything about. Whereas, maybe there aren't SQL injection concerns for GUID or integer fields, so expressions are allowed there. Or, does the system just have no way of differentiating a literal string from an expression/function? And GUID & integer fields don't have this problem because strings aren't valid in those fields? Edit - AGOL idea: Allow expressions in AGOL string field > default value
... View more
2 weeks ago
|
0
|
1
|
415
|
|
POST
|
Esri Case #04168794 - ArcGIS Online - Add Field dialog says GUID field length will be 36, but resulting field length is 38 This is expected because 38 includes dashes and brackets. For reference, I've included an example below. (More information regarding this can be found here.) Example: {7ec3018d-4a49-4a13-8e15-005846b25848}
... View more
2 weeks ago
|
0
|
0
|
212
|
|
POST
|
Good point. I have to admit, I haven't used relationship classes much. I'll try them out. Do they automatically populate GUID fields?
... View more
2 weeks ago
|
0
|
0
|
213
|
|
POST
|
Nice find! Replacing the parameter of IDENT_CURRENT with the layer/table's internal table name (you can get this from the layer/table properties in the Admin REST API) gives me a copy of the Object ID. I didn't see the database name, user name, or true table name in the Admin REST API page. But I did find it in the JSON definition of the layer. Is that where you got yours too, or am I missing something in the main Admin REST API page? Also, a couple of observations: This technique doesn't seem to back-populate existing rows properly, when nullable:false. The existing rows will all be set to the same value — the largest OBJECTID. I suppose this could be corrected with a field calculation if the field is editable. Edit: I wonder if we should keep an eye on this in other scenarios. Are there any gotchas? For example, what happens if we bulk load or populate rows? Will it populate the IDs correctly, or will they all be the same value (the largest OBJECTID)? I ended up disabling editing on this field because when editable:true (and when nullable:true), the web map Edit pane was setting the field to null, overriding the default value. This is what I settled on: {
"fields":
[
{
"name" : "unique_id",
"type" : "esriFieldTypeInteger",
"alias" : "Unique ID",
"sqlType" : "sqlTypeOther",
"nullable" : true,
"editable" : false,
"visible" : true,
"domain" : null,
"defaultValue" : "IDENT_CURRENT('db_2xxxx.user_2xxxx.test_layer_TEST_LAYER')"
}
]
}
... View more
2 weeks ago
|
0
|
3
|
429
|
|
POST
|
I was playing around with default values in a integer column in a hosted feature layer. 1+1 worked as a default value: {
"fields":
[
{
"name" : "MyID6",
"type" : "esriFieldTypeInteger",
"alias" : "My ID 6",
"sqlType" : "sqlTypeOther",
"length" : 38,
"nullable" : false,
"editable" : false,
"domain" : null,
"defaultValue" : "1+1"
}
]
} But when I tried OBJECTID+1, I got an error message: {
"fields":
[
{
"name" : "MyID7",
"type" : "esriFieldTypeInteger",
"alias" : "My ID 7",
"sqlType" : "sqlTypeOther",
"length" : 38,
"nullable" : false,
"editable" : false,
"domain" : null,
"defaultValue" : "OBJECTID+1"
}
]
} The name \"OBJECTID\" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted. I googled the second sentence of that error message, and it appears to be a SQL Server message. This message is a specific SQL Server error (Msg 128) that occurs when you attempt to use a column name in a database context where it is not allowed, such as within a DEFAULT constraint or during a data insertion where string quotes are missing. Using Columns in Default Constraints: You cannot set a column's DEFAULT value to equal the value of another column in the same table. https://share.google/aimode/tmot43yg8Iehd54KU So I guess that's more evidence that we're dealing with SQL Server? Additionally, I've seen some JSON examples online that have "defaultValue": "GetDate() WITH VALUES". GetDate() appears to be a SQL Server thing too.
... View more
2 weeks ago
|
0
|
5
|
440
|
|
POST
|
Would someone with DBA privileges in an on-prem Portal datastore database be able to poke around in a table to see if there are any database sequences used that would also be available in AGOL? (This is more of an “out of curiosity” thing to see if we can learn anything interesting, not necessarily something that should be done in a mission-critical AGOL feature layer without testing.)
... View more
2 weeks ago
|
0
|
0
|
259
|
|
POST
|
It’s possible to automatically populate the default value of an AGOL hosted feature layer GUID field using NEWID() WITH VALUES, using the Admin REST API. https://community.esri.com/t5/arcgis-online-questions/add-guid-field-to-existing-agol-survey123-feature/m-p/1698411/highlight/true#M68519 Is there a way to do something similar, but instead of populating a GUID field, populate a sequential integer in a number field? (Or a textual ID with a prefix like SEWER-0000001 ?) For example, is there a function similar to NEWID() that gets the next available integer for the layer/table from a database sequence? An integer would be preferable over a GUID because it’s shorter and human-readable. All of our other asset IDs are integers or text-integer format, not GUIDs.
... View more
2 weeks ago
|
0
|
3
|
304
|
|
IDEA
|
It sounds like we can add calculated expression fields to “advanced views” in AGOL via the Admin REST API. The view would be uneditable. Add to Definition (Feature Service) "sourceLayerFields": [
{
"name": "zipcode",
"source": "zipcode"
},
{
"name": "salesavg",
"alias": "SaleAveragePerCustomer",
"expression": "(Total_Sales_FY13 + Total_Sales_FY14) / Customers",
"type": "esriFieldTypeDouble"
}
] LinkedIn video: https://www.linkedin.com/posts/abdillahi-hassan-56a020134_esri-arcgis-ugcPost-7360636518803152896-NnkQ/ (It also looks like there's some GROUP BY / aggregation functionality in some of the JSON examples too.) This idea is to create an expression field in a view using the UI, instead of using the Admin REST API, which isn’t user friendly for non-developers.
... View more
2 weeks ago
|
3
|
1
|
279
|
|
POST
|
Based on comments in Support for Attribute rules in ArcGIS Online: @Allison_Hockey @IvanKozoletov1 @PaulBarr @RichardLittlefield @KevinMayall @CalvinHarmin @LeviCecil might find this post interesting. You might also like Expression field in view using AGOL UI. Also: Since you mentioned Survey123 if you are using Connect, there is uuid() function you can use to populate a unique id https://community.esri.com/t5/arcgis-online-questions/auto-populate-unique-id-field-in-hosted-feature/m-p/1698270/highlight/true#M68512 And Understanding Relationship Classes in ArcGIS Online Hosted Feature Services
... View more
2 weeks ago
|
1
|
0
|
445
|
|
IDEA
|
For anyone who’s interested, it sounds like we can add calculated expression fields to “advanced views” in AGOL via the Admin REST API. The view would be uneditable. And this only seems to work for views with joins. Add to Definition (Feature Service) "sourceLayerFields": [
{
"name": "zipcode",
"source": "zipcode"
},
{
"name": "salesavg",
"alias": "SaleAveragePerCustomer",
"expression": "(Total_Sales_FY13 + Total_Sales_FY14) / Customers",
"type": "esriFieldTypeDouble"
}
] Abdillahi Hassan shows it in a video on LinkedIn: https://www.linkedin.com/posts/abdillahi-hassan-56a020134_esri-arcgis-ugcPost-7360636518803152896-NnkQ/ That’s not the same as attribute rules. But is related. Ideas: Expression field in view using AGOL UI Expression field in advanced AGOL view without join
... View more
2 weeks ago
|
0
|
0
|
158
|
|
POST
|
@MobiusSnake You mentioned T-SQL. Is the AGOL database SQL Server? I assumed it was PostgreSQL. But not my area of expertise.
... View more
3 weeks ago
|
0
|
9
|
555
|
|
POST
|
@MobiusSnake This really helped me. Thanks. Any idea where we can find documentation on NEWID() ?
... View more
3 weeks ago
|
0
|
11
|
569
|
| Title | Kudos | Posted |
|---|---|---|
| 2 | 2 weeks ago | |
| 1 | 2 weeks ago | |
| 1 | 03-19-2026 09:29 AM | |
| 2 | 2 weeks ago | |
| 1 | 2 weeks ago |