|
POST
|
When I saw the reference saying it wasn't possible because the form only had access to the current feature, I didn't really spend time picking apart your code, but offered an example that I already had that I knew was working. However, if I replace my code with $featureset instead, it still works fine in both. Turns out, that for some reason, you line 12 is evaluating to Null in Field Maps, so returns the value of 1. Not sure why it works in Map Viewer, but, as you have seen, it does. So, I added a console statement to return the max_Tree_feature and saw that it is returning a dictionary string: So I tested by just extracting the TreeNumber value from the string to test for null (line 12) and it worked. So, after all that, if I would have just said to replace line 12 with: if(max_Tree_feature.TreeNumber == null) { return 1 } Then your original code works as expected in both map viewer and Field Maps. R_
... View more
07-28-2023
01:22 PM
|
1
|
1
|
2022
|
|
POST
|
Well, whether you are entering the project number in the field, or if it is being calculated, you need some way for that to get populated. If it is populated, then this script will find the highest tree number for that project and populate the tree number field. // if this feature already has a Tree Number, return that
if(!IsEmpty($feature.TreeNumber)) {
return $feature.TreeNumber
}
else {
var trees = FeatureSetByName($datastore,"TreeTest",['TreeNumber'],false)
var projectNumber = $feature.ProjectNum
var Tree_features = Filter(trees, "ProjectNum = @projectNumber")
var numarray = []
for (var n in Tree_features){
var nn = Number(n.TreeNumber)
Push(numarray, nn)
}
var maxnum = Max(numarray)
var newnum = maxnum + 1
return newnum
} This works if the project number is typed in manually, calculated by the form, picked from a dropdown list, or populated with a template, etc. So, depending on how may projects you have, there may be a less cumbersome way to deal with it than editing the arcade all the time. Could make a separate map for each project, create a domain so there is a dropdown list to pick the project number in the form, (can always have them type it in), or, could create templates so there is a button for each project that has projectNum default value. That way, when you add a new feature with it, the correct project number is entered, then it has enough info to find/update the tree number. By what ever method used to assign the project number, this should work fine 'once' the project number is in the field so the form has access to it. R_
... View more
07-28-2023
08:06 AM
|
0
|
3
|
6837
|
|
POST
|
OK, if I'm understanding you correctly, you have a separate Field Maps map for each project, and, when you add a feature, the project number is calculated in the form. So, ALL features added with 'this' map will have the same project number. Let's say it's '1234'. // if this feature already has a Tree Number, return that
if(!IsEmpty($feature.TreeNumber)) {
return $feature.TreeNumber
}
else {
var trees = FeatureSetByName($datastore,"TreeTest",['TreeNumber'],false)
var Tree_features = Filter(trees, "ProjectNum = '1234'")
var numarray = []
for (var n in Tree_features){
var nn = Number(n.TreeNumber)
Push(numarray, nn)
}
var maxnum = Max(numarray)
var newnum = maxnum + 1
return newnum
} If this is the case, the above code is doing exactly has you hoped, and it works in both Map Viewer and Field Maps. You would then just change the '1234' to the project number for each respective map. If I'm still not understanding correctly, I would need to know a little more specifics of how and WHEN the project number gets assigned to help further. R_
... View more
07-27-2023
04:55 PM
|
0
|
5
|
2035
|
|
POST
|
This seems to be working. Stand alone table, but, added to the map. var SpeciesCode = $feature.Species
var table = FeatureSetByName($map, "TreeTable",['SPC_CODE', 'BOTANICAL'])
var filteredTable = Filter(table, "SPC_CODE = @SpeciesCode")
var result = First(filteredTable)
if(!IsEmpty(result)){
return result.BOTANICAL
} May have to adjust the field names. R_
... View more
07-27-2023
03:27 PM
|
1
|
1
|
2744
|
|
POST
|
Guess I'm a bit confused. If it is always hardcoded to the same number, why the need for a Filter? In any case, this works for me to auto populate the next sequential number to the TreeNumber field (Calculated expression on TreeNumber field in form). // if this feature already has a Tree Number, return that
if(!IsEmpty($feature.TreeNumber)) {
return $feature.TreeNumber
}
else {
var vals = FeatureSetByName($datastore,"TreeTest",['TreeNumber'],false)
var numarray = []
for (var n in vals){
var nn = Number(n.TreeNumber)
Push(numarray, nn)
}
var maxnum = Max(numarray)
var newnum = maxnum + 1
return newnum
} R_
... View more
07-27-2023
02:32 PM
|
0
|
1
|
4831
|
|
POST
|
I use this script for that purpose all the time. ( I don't use the provider credential part, just hardcode the user/password in the script) I have my table in Excel and sort the way I want. Then I use this formula to 'JSONify' it: ="{" & """name"""&" : "&"""" & A2 & """" & ", " &"""code""" & " : " & """" & B2 & """" & "}," Delete the last comma, copy/paste (values) into the update_dict portion of the script, and run it. I normally run from a Notebook in Pro. Will replace the Domain list with the new one, sorted the same way as the input table. If I need to make changes in the future, just open the notebook, make the changes in the upadte_dict, and re-run. R_
... View more
07-27-2023
01:44 PM
|
1
|
0
|
2993
|
|
POST
|
Often this is caused by trying to access data from a mapped path (other than drives local to the computer). When logged on, it sets the paths for users. When running as scheduled task (and not logged in), does not have access to the mapped drives, so will not find the dataset(s). R_
... View more
07-27-2023
07:22 AM
|
1
|
0
|
890
|
|
POST
|
@MiguelParedes , that is a confusing page. Correct me if I'm wrong, but doesn't that page say "you can't do it", then the last sentence says "you can do it with python" (as per the link I supplied above)? Seems that should day "you can't do it with Desktop"....... Wondering if I'm missing something, or if that link is outdated (like the link on it). R_
... View more
07-27-2023
07:10 AM
|
0
|
0
|
2392
|
|
POST
|
any chance there may be Excel data in the map, and, do you have the drivers/redistributable installed? Seems I remember project hanging forever and not opening in this situation in the past until I installed all the appropriate files. Otherwise, not sure what to try next. Since it extracted, but can't open the map, you may just load all the extracted data directly and see if something breaks. R_
... View more
07-26-2023
03:18 PM
|
0
|
0
|
4417
|
|
POST
|
You could try changing the photo upload size in Field Maps Designer to small, save, reload the map in FM app and re-test. Might tell you if it is an issue with file size. For some reason, two of my FM maps 'changed' the setting on their own (actually, the setting was still set to small, but they started saving actual size). Changing it, saving it, changing it back again fixed that for me. Just a though of what to try, R_
... View more
07-26-2023
12:39 PM
|
1
|
1
|
1226
|
|
POST
|
Once selected, did you make a change (update) to the data so that the rule fires? R_
... View more
07-26-2023
09:35 AM
|
1
|
0
|
2998
|
|
POST
|
I use code similar to this post, but for text based identifiers. Since you want to append next sequence to text field, and, only apply to data matching a query (selected network), I use something like this: if(isempty($feature.ID) && $feature.SYMBOL_TYPE == "3SL-C (LEFT) STRAIGHT TRAFFIC ARROW"){
var vals = FeatureSetByName($datastore,"StripingPoints",['ID'],false)
var STLCvals = Filter(vals, "ID LIKE 'STLC%'")
var numarray = []
for (var n in STLCvals){
// console(n)
var nn = Number(Replace(n.ID, 'STLC',''))
Push(numarray, nn)
}
var maxnum = Max(numarray)
var maxtext = Concatenate('STLC',(Text(maxnum + 1, '00000')))
return maxtext
} Which separates the text part from the number so it can find the highest existing number, then concatenates that back to text string with formatting. You will have to adjust for you fields, etc. but might get you along the right path. R_
... View more
07-26-2023
08:32 AM
|
0
|
0
|
841
|
|
POST
|
Extract Package GP tool or Import map seems to work, at least with 130Mb file. If import doesn't work, might try the Extract method.
... View more
07-25-2023
03:56 PM
|
1
|
1
|
4438
|
|
POST
|
How are you getting the ProjectNum on a 'new' feature? Is this something that you are entering in the form right at first? Do you have separate Field Maps map per project? Trying to figure out how to filter on a value that doesn't exist on initial feature creation. R_
... View more
07-25-2023
03:44 PM
|
0
|
3
|
4848
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-14-2026 04:00 PM | |
| 1 | 09-14-2022 07:53 AM | |
| 1 | 09-14-2022 08:23 AM | |
| 1 | 05-21-2026 08:53 AM | |
| 1 | 05-14-2026 04:28 PM |
| Online Status |
Online
|
| Date Last Visited |
a week ago
|