|
POST
|
Seems like you saved the unicode symbol and the double quotes as actual text. Try this: # define a function that will convert 'u"1234_5678"' to '1234_5678'
# CalculateField needs it as string
code_block = """
def clean_up(text_value):
if text_value.startswith('u"'):
text_value = text_value[1:] # remove unicode symbol
return text_value.replace('"', '') # remove double quotes
"""
func_1 = "clean_up(!AttArt_Ken!).split('_')[0]" # without single quotes around the field name!
field_1 = "ObjArt_Ken"
func_2 = "clean_up(!AttArt_Ken!).split('_')[1]" # without single quotes around the field name!
field_2 = "Wert"
arcpy.AddField_management(inTable, field_1, "TEXT".encode('utf-8'))
arcpy.CalculateField_management(inTable, field_1, func_1, "PYTHON_9.3", code_block)
arcpy.AddField_management(inTable, field_2, "TEXT".encode('utf-8'))
arcpy.CalculateField_management(inTable, field_2, func_2, "PYTHON_9.3", code_block)
... View more
01-20-2022
05:10 AM
|
0
|
0
|
10511
|
|
POST
|
OK, that probably gets a little more complicated. But I can't make sense of your equation. Am I correct in guessing that Elevation is a field in Table2, and invertDownField is a field in Table1? Can you describe what you want to calculate?
... View more
01-18-2022
11:49 PM
|
1
|
2
|
2880
|
|
POST
|
// Calculation Attribute Rule on Table1
// field: FieldB
// triggers: insert, update
// load the related features of Table2 using one of these methods:
// if you have a relationship class between the tables:
var fs_table2 = FeatureSetByRelationshipName($datastore, "NameOfTheRelationshipClass", ["*"], false)
// if not:
var fs_table2 = FeatureSetByName($datastore, "Table2", ["*"], false)
var key = $feature.GlobalID
fs_table2 = Filter(fs_table2, "Table2GlobalID = @key")
// get the sum of Table2.FieldA
var t2_a_sum = Sum(fs_table2, "FieldA")
// return
return t2_a_sum
... View more
01-17-2022
09:59 PM
|
1
|
4
|
2915
|
|
POST
|
Are you absolutely sure that the field is actually named parent_guid? If you have a relationship class connecting the two tables, you can also try to use FeatureSetByRelationshipName. // calculation attribute rule on child
// field: if you want to get only one field from the parent, then chose
// that field. if you want to get multiple fields, leave empty
// triggers: Insert(, update)
// load the related parent features using one of these methods
// if you have a relationship class between parent and child:
var parent_fs = FeatureSetByRelationshipName($feature, "RelationshipName")
// if not
var parent_fs = FeatureSetByName($datastore, "NameOfParentFC")
var key = $feature.ForeignKeyField
parent_fs = Filter(parent_fs, "PrimaryKeyField = @key")
// return nothing if no parent feature was found
var parent = First(parent_fs)
if(parent == null) { return }
// if you want to return only one field:
return parent.Field
// if you want to return multiple fields:
var att = {
"Field1": parent.Field1,
"Field2": parent.Field2
}
return {"result": {"attributes": att}}
... View more
01-16-2022
09:56 PM
|
1
|
2
|
2274
|
|
POST
|
I didn't know your data structure, so I had to guess at the layer and field names. You should replace them with your real names. Line 2: click on FeatureSetByName and replace my function with what you get Line 11: replace LandUseField with Land_Use
... View more
01-14-2022
06:40 AM
|
0
|
0
|
6369
|
|
POST
|
Assuming you want to get the land use by intersection with the parcel: // load the land use layer
var fs_land_use = FeatureSetByName($map, "LandUse", ["*"], true)
// intersect the parcel feature with the land use layer
var fs_land_use_intersect = Intersects($feature, fs_land_use)
// get the first intersecting land use feature
var land_use_feature = First(fs_land_use_intersect)
// no land use feature? -> return null
if(land_use_feature == null) { return null }
// else return the land use field
return land_use_feature.LandUseField
... View more
01-14-2022
05:52 AM
|
0
|
2
|
6381
|
|
IDEA
|
This would be great. parameters[1] is just so non-descriptive as opposed to parameters.InTable or parameters["InTable"] using indices is just suicide when you are still adding/removing/moving parameters I use the dictionary approach in every one of my tools and it's not too much hassle, but it could be completely avoided if parameters was a named tuple from the start. That would also save me from having to create the dict multiple times in a tool (updateParameters(), updateMessages() and execute())
... View more
01-13-2022
10:41 PM
|
0
|
0
|
3226
|
|
POST
|
First() only finds the first feature intersecting the buffer, not the closest one. You get the error because you try to get "label" from the feature set, not from the first feature. return First(nearestFilter)["label"]; This is how I do it in my Attribute Rules: function closest_feature(test_feature, compare_feature_set) {
var min_distance = 9999999
var closest_feature = null
for(var f in compare_feature_set) {
var d = Distance(test_feature, f)
if(d < min_distance) {
min_distance = d
closest_feature = f
}
}
return closest_feature
}
var fs_assets = FeatureSetByName($datastore, "AssetFC", ["label", "type"], true)
var fs_filtered_assets = Filter(fs_assets, "type = 'Asset Type 1'")
var fs_close_assets = Intersects(fs_filtered_assets, Buffer($feature, 500, "feet"))
var closest_asset = closest_feature($feature, fs_close_assets)
if(closest_asset == null) {
return null
}
return closest_asset.label
... View more
01-13-2022
10:12 PM
|
0
|
0
|
914
|
|
POST
|
Go into the symbology pane, choose Unique Values, click on Set an expression, paste the code below. var exp_date = $feature.Expires
var start_date = Date(2030, 0, 21) // start of the first class (month is 0-based)
var year_delta = 4 // class width
for(var i = 0; i < 50; i++) { // try 50 times
// get end_date
var end_date = DateAdd(start_date, year_delta, "years")
end_date = DateAdd(end_date, -1, "days")
// if in class, return
if(exp_date >= start_date && exp_date <= end_date) {
return Text(start_date, "DD/MM/Y") + " - " + Text(end_date, "DD/MM/Y")
}
// else increment the start date
start_date = DateAdd(start_date, year_delta, "years")
}
// if no class found after 50 times, return default value
return "unclassed" Note that I followed the date format of your text (DD/MM/Y), not the one in your expression (MM/DD/Y). You can change that in line 11.
... View more
01-12-2022
10:31 PM
|
1
|
1
|
1522
|
|
POST
|
Only thing I can find right now: https://developers.arcgis.com/web-appbuilder/guide/xt-app-url-parameters-for-dev.htm#ESRI_SECTION1_01F86DEC2181416888D44A32D3096887 The app supports two styles of layout based on the screen size. One is for desktop and one is for mobile devices. When either the height or width of a screen display is less than 600 pixels, the mobile layout is applied automatically. However, this may result in unexpected behavior when the app is embedded in a website. For example, the pop-up in the website changes to the mobile layout style. To control the layout style, use mobileBreakPoint=<pixel number>. For example, you can remain in desktop style until the screen size is less than 300 pixels, as shown below: https://<your app>/?mobileBreakPoint=300
... View more
01-12-2022
04:43 AM
|
1
|
0
|
5265
|
|
POST
|
No reason to be ashamed, we've all had our share of facepalm moments... Glad it works 🙂 If you want to trigger the rule for all features, use CalculateField on Namn and just put some random value in it.
... View more
01-12-2022
04:13 AM
|
0
|
1
|
3645
|
|
POST
|
That's the style for popups on mobile devices. It also appears on PC if the Browser window is small. Try maximizing the Chrome window.
... View more
01-12-2022
03:23 AM
|
3
|
4
|
5280
|
|
POST
|
Have you actually triggered the rule? Eg updated the feature? Try putting in a value into Kommentar or Namn
... View more
01-12-2022
03:17 AM
|
0
|
4
|
3647
|
|
POST
|
Try using the simple name of the field (like you did in your code above): var parent_fs = FeatureSetByRelationshipName($feature, "Matstallen_Rate", ['Namn']) Make sure that "Matstallen_Rate" is actually the name of the relationship class, not the name of the parent feature class! Try using the full name of the relationship class: "DatabaseName.DataOwner.Matstallen_Rate"
... View more
01-12-2022
01:32 AM
|
0
|
6
|
4843
|
|
POST
|
var raw_re = [$feature.RE1, $feature.RE2, $feature.RE3, $feature.RE4, $feature.RE5]
var filled_re = []
for(var i in raw_re) {
if(!IsEmpty(raw_re[i])) {
Push(filled_re, raw_re[i])
}
}
return Concatenate(filled_re, "/")
... View more
01-12-2022
01:15 AM
|
0
|
0
|
1300
|
| 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
|