|
POST
|
Try selecting this option in all tables: To show the relevant documents in the popup, you could use something like this expression: // load the tables
var table_a = FeatureSetByName($datastore, "TableA")
var table_b = FeatureSetByName($datastore, "TableB")
// I think you don't need C
//var table_c = FeatureSetByName($datastore, "TableC")
// Get the document ids
var plot_id = $feature.PlotID
var filtered_b = Filter(table_b, "PlotID = @plot_id")
if(filtered_b == null || Count(filtered_b) == 0) {
return "No documents"
}
var doc_ids = []
for(var b in filtered_b) {
Push(doc_ids, b.DocumentID)
}
// get the document paths
var filtered_a = Filter(table_a, "DocumentID IN @doc_ids")
if(filtered_b == null || Count(filtered_b) == 0) {
return "No documents"
}
var docs = []
for(var a in filtered_a) {
Push(docs, a.DocumentPath)
}
// return paths
return Concatenate(docs, TextFormatting.NewLine)
... View more
06-28-2021
11:37 PM
|
0
|
1
|
1545
|
|
POST
|
Build relationship classes or relates between the owner table and the property feature classes. In the owner table, check this option: Now when you select an owner, all their properties will be selected.
... View more
06-28-2021
11:09 PM
|
1
|
3
|
1993
|
|
POST
|
Haven't worked with Arcade in Dashboards yet, but in other applications it would work like this: var options = Split($datapoint["example_field_name"], ",")
var formatted_options = []
var formats = [
["option1", "Option 1"],
["option2", "Option 2"],
["option3", "blah"],
["option4", "blub"]
]
for(var f in formats) {
if(Includes(options, formats[f][0])) {
Push(formatted_options, formats[f][1])
}
}
return Concatenate(formatted_options, ", ")
... View more
06-28-2021
01:34 AM
|
1
|
1
|
2522
|
|
POST
|
// Calculation Rule
// Triggers: Insert
// create centroid
var cent = Centroid($feature)
// repeat this block for each intersecting feature class (change variable names!)
/////
var intersect_feature = First(Intersects(FeatureClassByName($map, "FeatureClass"), cent))
var value = null
if(intersect_feature != null) {
value = intersect_feature.Value
}
/////
// return the values
return {
"result": {
"attributes": {
"Field1": value_1,
"Field2": value_2
}
}
}
... View more
06-28-2021
01:07 AM
|
2
|
0
|
4155
|
|
POST
|
There are a few possibilities, depending on what you're working with. If you have an Enterprise geodatabase, showing the latest record is really easy: Create a query layer (stored in the map document) or a database view (stored in the database) with the follwing SQL: SELECT t1.*, t2.*
FROM Table1 t1
INNER JOIN (
SELECT Location_ID, MAX(Date) MaxDate
FROM Table2
GROUP BY Location_ID
) MaxDates
ON t1.Location_ID = MaxDates.Location_ID
INNER JOIN Table2 t2
ON MaxDates.Location_ID = t2.Location_ID AND MaxDates.MaxDate = t2.Date Both tools can be found in the DataManagement toolbox in the toolset "Layers and Table Views". However, making sure that the record is within the boundaries would be more complcated. If you work in ArcGIS Pro, you can use Attribute Rules. https://pro.arcgis.com/en/pro-app/2.7/help/data/geodatabases/overview/an-overview-of-attribute-rules.htm // Constraint Rule
// Table 2
// Triggers: Insert, Update
// Rejects the edit if the Recorded_Value is not within the upper and lower limits defined in Table 1
// load table 1
var tbl_1 = FeatureSetByName($datastore, "Table1", "*", false)
// filter table 1 by Location_ID
var loc_id = $feature.Location_ID
var loc = First(Filter(tbl_1, "Location_ID = @loc_id"))
// test if value falls within bounds, return true or false
var val = $feature.Recorded_Value
if(val >= loc.Lower_Limit_m && val <= loc.Upper_Limit_m) {
return true
}
return false // Calculation Rule
// Table 2
// field: Recorded_Value
// Triggers: Insert
// If you add a new record to Table 2, the Recorded_Value will be written into Table1.CurrentValue_m
// This assumes that the record you add is actually the latest one!
// load table 1 and get the globalID of the location
var loc_id = $feature.LocationID
var g_id = First(Filter(FeatureSetByName($datastore, "Table1", ["Location_ID", "GlobalID"], false), "Location_ID = @loc_id")).GlobalID
// write the Rcorded_Value into Table1.Current_Value_m
return {
"result": $feature.Recorded_Value,
"edit": [
{
"className": "Table1",
"updates": [
{"globalID": g_id, "attributes": {"Current_Value_m": $feature.Recorded_Value}},
]
}
]
} If none of that works for you, you can use a Python script, but you'd have to manually run it every time you insert new records.
... View more
06-28-2021
12:42 AM
|
0
|
0
|
3038
|
|
POST
|
@Cookie010103: Sorry, kinda forgot about this thread. You should absolutely use Duncan's solution. @DuncanHornby: This is great, thanks! Sometimes I jump to using code without checking out tools I don't know... TIL
... View more
06-24-2021
11:19 PM
|
0
|
0
|
3826
|
|
POST
|
Good to hear, glad I could help. Please mark an answer as solution, so that it gets shown at the top directly under the question.
... View more
06-21-2021
11:33 PM
|
0
|
0
|
9791
|
|
POST
|
All the datasets in the PGSQL schema are owned by the connected user so I skipped the datasets removal. Is this also true for the views? Maybe try it anyway... I just thought about this: the documentation doesn't say whether it works for views that aren't registered with the database. Have you rgistered your views (I have and don't get errors)? Did you try the SQL query from arcpy.ArcSDESQLExecute or from pgAdmin ? The second worked for me. I used ArcSDESQLExecute, but I work with a Microsoft SQL Server, not PostgreSQL.
... View more
06-21-2021
07:36 AM
|
0
|
0
|
5038
|
|
POST
|
I don't know why your SQL query fails (it works for me), so I will concentrate on your actual problem. Including views in the dataset list doesn't give any errors for me. I guess you already know the help page, because your code looks very similar (as does mine...), but still: https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/analyze-datasets.htm Points of notice: AnalyzeDatasets can only analyze datasets that are owned by the connected database user! I don't think that function is for relationship classes. At least I got an error when I tried right now. Try removing the datasets the connected user doesn't own (copied from the help page): dataList = arcpy.ListTables() + arcpy.ListFeatureClasses() + arcpy.ListRasters()
# Next, for feature datasets get all of the datasets and featureclasses
# from the list and add them to the master list.
for dataset in arcpy.ListDatasets("", "Feature"):
arcpy.env.workspace = os.path.join(workspace,dataset)
dataList += arcpy.ListFeatureClasses() + arcpy.ListDatasets()
# reset the workspace
arcpy.env.workspace = workspace
# Get the user name for the workspace
userName = arcpy.Describe(workspace).connectionProperties.user.lower()
# remove any datasets that are not owned by the connected user.
userDataList = [ds for ds in dataList if ds.lower().find(".%s." % userName) > -1]
# more readable:
# userDataList = [ds for ds in dataList if userName in ds.lower()]
# Execute analyze datasets
# Note: to use the "SYSTEM" option the workspace user must be an administrator.
arcpy.AnalyzeDatasets_management(workspace, "NO_SYSTEM", userDataList, "ANALYZE_BASE","ANALYZE_DELTA","ANALYZE_ARCHIVE")
... View more
06-21-2021
06:19 AM
|
0
|
2
|
5085
|
|
POST
|
If your lines are always separated by the same character ("/" in your image), you can use this: // show_line_1
var lines = Split($feature.LineField, "/")
return IIF(Includes(lines, "Line 1"), "block", "none") If Includes is not available for you yet (it came with the latest Arcade version), it would be a bit more cumbersome: // show_line_1
var lines = Split($feature.LineField, "/")
for(var i in lines) {
if(lines[i] == "Line 1") { return "block" }
}
return "none"
... View more
06-20-2021
10:10 PM
|
1
|
9
|
5932
|
|
POST
|
This is for ArcGIS! Comment out line 9 or 10, depending on whether you work with ArcGIS Pro or ArcMap. I'm very sure you could do something like that in QGIS, but I dont know how, as I don't work with QGIS.
... View more
06-18-2021
06:15 AM
|
1
|
0
|
3971
|
|
POST
|
import arcpy, os
points = "Point_layer_or_feature_class"
polygons = "Polygon_layer_or_feature_class"
out_table = "PathToOutputTable"
# Intersect points and polygons
in_features = [points, polygons]
intersect_points = "memory/intersect_points" # this is for ArcGIS Pro
# intersect_points = "in_memory/intersect_points" # this is for ArcMap
arcpy.analysis.Intersect(in_features, intersect_points)
# you now have a point feature class with the attributes of the original points and the attributes of the polygon the points are in.
# read the data into a list
fields = ["Grid_ID", "Name"]
point_data = [row for row in arcpy.da.SearchCursor(intersect_points , fields)]
# get the grid ids from the polygons
grid_ids = [row[0] for row in arcpy.da.SearchCursor(polygons, ["Grid_ID"])]
# if you don't care about polygons with 0 points in them, use this instead:
# grid_ids = list(set([p[0] for p in point_data]))
# create out_table
try:
arcpy.management.Delete(out_table)
except:
pass
arcpy.management.CreateTable(os.path.dirname(out_table), os.path.basename(out_table))
arcpy.management.AddField(out_table, "Grid_ID", "LONG")
arcpy.management.AddField(out_table, "Count", "LONG")
arcpy.management.AddField(out_table, "Name", "Text")
# for each grid_id, search point_data for all points with that grid_id, get the count and all names, write the result into out_table
with arcpy.da.InsertCursor(out_table, ["Grid_ID", "Count", "Name"]) as cursor:
for grid_id in grid_ids:
names_in_polygon = [p[1] for p in point_data if p[0] == grid_id]
count = len(names_in_polygon)
unique_names = ", ".join(set(names_in_polygon))
cursor.insertRow([grid_id, count, unique_names])
... View more
06-18-2021
04:34 AM
|
2
|
1
|
3986
|
|
POST
|
What you describe isn't possible right now, because Arcade doesn't recognize selections. It is absolutely possible to get other tables (take a look at the FeatureSetBy* functions) and to edit another table (take a look at this blog). So you could get your feature class with FetaureSetBy* and then filter it. For that, you need a field that is in both tables. In your case, that is likely the ID, and you want to get that, so this way isn't possible. If the table you're creating a new row in (step 2) is a feature class, maybe an intersect works for you ("If this new point intersects an existing polygon, take that polygon's ID"). If you have a feature class and a non-spatial table, and the only field linking those is ID, then you can't do this with Arcade. What you could do: Create a relationship class between the fc and table Select a feature Open the Attribute Pane Expand the feature to see its relationships Right click on the relationship you created, "Add New To Relationship" ArcGIS creates a new record in the related table, puts the feature's ID in the field specified by the relationship class, and opens the new row in the Attribute pane.
... View more
06-18-2021
12:10 AM
|
1
|
2
|
5573
|
|
POST
|
To get the pdf path without another search, it will have to be in the same table, so join. If AddressPoints and PDF are related by a relationship class, you could try FeatureSetByRelationshipName, maybe it's faster: address_info = cnt + " Address(es):";
for (var address in addresspoints) {
// filter your pdf table
var pdf_row = First(FeatureSetByRelationshipName(address, "RelationshipName", ["Path"])
// if a pdf was found, display the path after the full address
var pdf_path = ""
if(!(pdf_row == null || IsEmpty(pdf_row))) {
pdf_path = "; PDF: " + pdf_row.Path
}
var address_text = (counter++) + ". " + address.FullAddress + pdf_path
address_info += TextFormatting.NewLine + address_text;
}
... View more
06-17-2021
11:39 PM
|
0
|
0
|
5984
|
|
POST
|
As Josh said, if you want to format the lines differently in the popup, you will have to create an expression for each of your lines. // expression/show_line_1
// returns "none" if "Line 1" is not found in the Line field
// returns "block" if it is found
var result = Find("Line 1", $feature.LineField)
if(result == -1) { return "none" }
return "block" In your popup configuration, switch to HTML source. <p style="font-weight: bold;">Lines at this stop:</p>
<div style="display: {expression/show_line_1}; color: red;">Line 1</div>
<div style="display: {expression/show_line_2}; color: green;">Line 2</div>
<div style="display: {expression/show_line_3}; color: blue; background:black;">Line 3</div> If you return "inline" instead of "block " in the expression, the lines will be shown next to each other.
... View more
06-17-2021
01:38 AM
|
1
|
11
|
5970
|
| 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
|