|
POST
|
I don't think that's it. The Cityworks URL works fine for me in a slightly different context. Our current way to handle this is to have a popup on the inspection feature layer. The popup has an expression that builds the URL string, which is returned as text and fed to a hyperlink in a text popup element. I built this back in the old map builder and it works just fine. What's funny is that it doesn't work when I bypass that and just go straight for <a>. Is the <a> tag working for you in Field Maps? And what version of Enterprise are you on?
... View more
10-22-2024
05:04 AM
|
0
|
0
|
2269
|
|
POST
|
Are you trying to select the newly generated XY features? Or use them to select something else? You would put the output feature class from step one as in_layer or select_features, respectively. Either way, make sure you can get the select by location working by itself first, then try stringing them together. That way you know you're only working on one problem at a time. Here's some sample code: #set variables
inTable = r"C:\Path\to\table.csv"
tableToPoint = r"in_memory\tablePoints" #if you don't need to keep it. Otherwise, save to file system
featuresToSelect = "C:\Sample.gdb\myFeatures"
#create points
arcpy.management.XYTableToPoint(inTable, tableToPoint, "x","y") #ideally you would know the coordinate system, defaults to WGS84
#select features touching xy points new selection
arcpy.management.SelectLayerByLocation(featuresToSelect, 'INTERSECT',tableToPoint)
#select features within 15 map units of xy points, new selection
arcpy.management.SelectLayerByLocation(featuresToSelect, 'INTERSECT',tableToPoint,15, 'NEW_SELECTION')
#select features more than 15 map units of xy points, new selection - note the "INVERT"
arcpy.management.SelectLayerByLocation(featuresToSelect, 'INTERSECT',tableToPoint,15, 'NEW_SELECTION', 'INVERT')
#select only features within 30 map units of xy points from an existing selection
arcpy.management.SelectLayerByLocation(featuresToSelect, 'INTERSECT',tableToPoint,30, 'SUBSET_SELECTION'))
#clean up
arcpy.management.Delete(tableToPoint) Just a note on the in_memory workspace. It's basically a file geodatabase that lives in the RAM. Great for smaller outputs that you don't need to keep, but use with caution. If you put a large dataset in there, it could use up too much memory and gum up the works until you close Pro.
... View more
10-22-2024
04:41 AM
|
1
|
2
|
1387
|
|
POST
|
That's a good catch, and a symptom of copy/pasting code from another layer. Interestingly, it still seems to return the correct result whether or not I explicitly include the FeatureUid field: I did try explicitly including it and it still errors out on the Field Maps side. I also tried hardcoding a URL to our company web site, and Field maps still doesn't like it. It looks like field maps has trouble with the <a> HTML tag, even though that's listed as supported HTML. I also realized I pasted the wrong code in for the table portion. I've corrected that now if you are interested in that as well.
... View more
10-18-2024
04:16 AM
|
0
|
2
|
2396
|
|
POST
|
Some additional testing reveals that I can add a single dummy row in by using hard coded values, but only outside of the for loop. Inside the for loop, the rows are not getting added, but it works fine outside of the loop. So the following code results in this in map viewer: and this in Field Maps: //start HTML text with table header
var baseText = `<table>
<tr>
<th align = "left" width = "100">Date</th>
<th align = "left" width = "120">Inspection Type</th>
<th>Summary</th>
</tr>
`
baseText += `<tr style = "background-color:#e6ff03">
<td>1/1/2024</td>
<td>Wet Check</td>
<td>This inspection never happened</td>
</tr>`;
//build table with alternating color rows
count = 1;
for(var i in relInspections){
var inspDate = `${Month(i.InspDate)}/${Day(i.InspDate)}/${Year(i.InspDate)}`;
var inspType = Decode(i.InspTemplateName,"Hydrant Dry Check Inspection",'Dry Check',"Hydrant Wet Check Inspection","Wet Check","Other");
var color = IIf(count%2==0 , '#ffffff', '#e6e6e6');
count += 1;
var newRow = `<tr style = "background-color:${color}">
<td>${inspDate}</td>
<td>${inspType}</td>
<td>${i.ObservationSum}</td>
</tr>`;
baseText += newRow;
baseText += `<tr style = "background-color:#e6ff03">
<td>1/1/2024</td>
<td>Wet Check</td>
<td>This inspection never happened</td>
</tr>`;
}
//finish HTML text
baseText += `</table>`;
... View more
10-17-2024
01:00 PM
|
0
|
0
|
2438
|
|
POST
|
I'm working on an Arcade content block expression for a popup that will be viewed in Field Maps. The goals are to show a link to a CW inspection or work order that needs to be completed (if applicable), and to display a table summarizing previous work on that asset. It works great in the map viewer, but does not work in Field Maps. Interestingly, the link fails completely, but the table will draw only the header row. I've split those two functions into different content blocks so I'm only dealing with one issue at a time. I've included screenshots and code snippets below. Anyone have an idea how to get that to work? I know I can get the hyperlink to work if I just pass it as a hyperlink in a text block, but that removes the "only show it if applicable" logic. The table is what really mystifies me, as the header displays just fine. For reference, I'm on Enterprise 11.1 and Field Maps 24.2.1 Here is my code for the link: //get open hydrant inspections
var currentInspections = FeatureSetByName($map, "Open Hydrant Dry Checks",['InspectionId']);
//find the inspection that matches this hydratn
var cwID = $feature.CW_ID;
var query = `FeatureUid = '${cwID}'`;
var inspNow = Filter(currentInspections,query);
//base url
var baseURL = "cityworks11://openWorkActivity?workActivityType=2&workActivityId=";
//if there is an inspection, create link
If(Count(inspNow)>0){
var inspectionID = First(inspNow)["InspectionId"];
var inspURL = baseURL + inspectionID;
var linkText = `<a href="${inspURL}" >Complete Dry Check Inspection In Cityworks Mobile</a>`;
}
//if not, return a blank line
else{
var linkText = ``;
}
return {
type : 'text',
text : linkText //this property supports html tags
} And here is the code for the table: //get previous inspections and find those that are for this hydrant
var prevInspections = FeatureSetByName($map, "Previous Hydrant Inspections",['InspectionId','InspTemplateName','InspDate','ObservationSum','FeatureUid']);
var cwID = $feature.CW_ID;
var query = `FeatureUid = '${cwID}'`;
var relInspections = OrderBy(Filter(prevInspections,query), 'InspDate DESC');
//start HTML text with table header
var baseText = `<table>
<tr>
<th align = "left" width = "100">Date</th>
<th align = "left" width = "120">Inspection Type</th>
<th>Summary</th>
</tr>
`
//build table with alternating color rows
count = 1;
for(var i in relInspections){
var inspDate = `${Month(i.InspDate)}/${Day(i.InspDate)}/${Year(i.InspDate)}`;
var inspType = Decode(i.InspTemplateName,"Hydrant Dry Check Inspection",'Dry Check',"Hydrant Wet Check Inspection","Wet Check","Other");
var color = IIf(count%2==0 , '#ffffff', '#e6e6e6');
count += 1;
var newRow = `<tr style = "background-color:${color}">
<td>${inspDate}</td>
<td>${inspType}</td>
<td>${i.ObservationSum}</td>
</tr>`;
baseText += newRow;
}
//finish HTML text
baseText += `</table>`;
return {
type : 'text',
text : baseText
}
... View more
10-17-2024
12:32 PM
|
0
|
6
|
2454
|
|
POST
|
You're not kidding about that being faster! I had to make a couple minor modifications, but it is returning the correct number of values for each cycle year. I can't seem to get it to populate values correctly for ShopDescription and District (returns NaN), but I was considering splitting out those categories at the Cityworks URL side, anyway. Thank you for your help!
... View more
09-20-2024
01:32 PM
|
0
|
0
|
1209
|
|
POST
|
Ah, that worked! Thank you. Theoretically, those are all unique. But I'm happy that works. Exposed another thing I need to sort out, but this get's me very close to the finish line.
... View more
09-20-2024
10:31 AM
|
0
|
2
|
1222
|
|
IDEA
|
Oh, that's great! Definitely missed that in the release notes. I haven't updated the machine I typically publish from to 3.3 yet, so I'll have to give that a shot once I get there.
... View more
09-20-2024
09:36 AM
|
0
|
0
|
814
|
|
POST
|
I'm having trouble with an Arcade data source that I want to use in a dashboard (Enterprise 11.1). The goal is to take some inspections in Cityworks and sort them into bins based on what year in a 5-year cycle they fall in, to help managers rebalance them. The problem is, the expression returns fewer values than it pulls in initially. Even more perplexing, the exact number of records returned each time is different: Here's the code I'm using (server names changed to protect the innocent). Is there something I'm missing in the code that could cause that? var portalItem = 'RanDOmP0rta1iDNUm85r';
var thisPortal = Portal('https://myserver.mydomain.com/portal');
var inspections = FeatureSetByPortalItem(thisPortal, portalItem, 58,['InspectionId','PrjStartDate','ShopDescription','DistrictDescription']);
//create dict to store updated features
var cycleYears = {
'fields': [{'name':'InspectionID', 'type': 'esriFieldTypeOID'},
{'name':'ShopDescription', 'type': 'esriFieldTypeString'},
{'name':'District', 'type': 'esriFieldTypeString'},
{'name':'CycleYear','type': 'esriFieldTypeDouble'}],
'geometryType': '',
'features': []
}
var count1 = Count(inspections);
console(`Records in: ${count1}`);
//put the year in each record into a bin
//append to dict
for(var f in inspections) {
var cycleYear = (Year(f.PrjStartDate) % 5) +1;
var new_f = {'attributes': {'InspectionID':f.InspectionID,
//'PrjStartDate':f.PrjStartDate,
'ShopDescription':f.ShopDescription,
//'Text1': f.Text1,
'District': f.DistrictDescription,
'CycleYear': cycleYear
}}
Push(cycleYears.features, new_f)
}
//convert to feature set and output as data source
var inspCounts = FeatureSet(Text(cycleYears));
var count2 = Count(inspCounts)
console(`Records out: ${count2}`);
return inspCounts;
... View more
09-20-2024
09:30 AM
|
0
|
4
|
1243
|
|
IDEA
|
This is definitely critical functionality, and I'm not sure why it's not included out of the box.
... View more
09-18-2024
05:39 AM
|
0
|
0
|
2753
|
|
IDEA
|
This is absolutely critical. I have tables that come in from a non-geodatabase source that I need for web services. Right now, we need to maintain a copy of the data in our geodatabase. Originally, there were some other requirements that made this necessary. Modern Arcade popup options have made this unnecessary. Being able to publish this other table as a standalone would vastly simplify our data storage and workflows.
... View more
09-17-2024
06:13 AM
|
0
|
0
|
842
|
|
POST
|
I've attempted this fix, but It stays on the same requests version. Is there something I'm missing?
... View more
09-13-2024
09:49 AM
|
0
|
0
|
3076
|
|
POST
|
I haven't tried pulling in matplotlib yet. I'm hoping to just stick with the Pandas tools to keep the code simpler for the end users. But that's a good suggestion. Edit: I just tried the method suggested. It did not make a difference.
... View more
08-23-2024
07:36 AM
|
0
|
0
|
1275
|
|
POST
|
I'm developing a notebook for our environmental science team to extract, visualize, and analyze well level readings. I got it most of the way there using the web-based Jupyter editor and plots were looking good. I brought the notebook into Pro 3.2 to finish developing it and make it easier to share. Now that it's in Pro, when I run the plot() method on the Pandas dataframe, the plots do not show. It looks like it's creating the plot object successfully, just not drawing it. Interestingly, the plots that had already been generated in the web version are still showing in Pro (see below). I did confirm that there is actually data in the dataframe I'm trying to plot. Does anyone know how I can force it to draw.
... View more
08-23-2024
05:54 AM
|
0
|
2
|
1310
|
|
POST
|
Fortunately, I fixed the server over the weekend. While less pressing, I'm still curious to know what the answer to this is.
... View more
08-19-2024
07:21 AM
|
0
|
0
|
511
|
| Title | Kudos | Posted |
|---|---|---|
| 9 | 08-27-2025 02:06 PM | |
| 1 | 10-22-2024 04:41 AM | |
| 2 | 01-17-2024 12:35 PM | |
| 2 | 05-18-2023 05:44 AM | |
| 1 | 04-15-2024 07:13 AM |
| Online Status |
Offline
|
| Date Last Visited |
a week ago
|