POST
|
Hi, Arcade is still very new to me so forgive me if this seems like a basic error. I'm trying to use arcade to loop through the rows of a feature class and return the number of non-null fields for each row. I'm using the following code but it just produces the number of items in the array (3) for each row: var array = [$feature.Welcoming,$feature.Access,$feature.Community]; var total = 0; for(var k in array){ Iif(isempty(k),total+=0,total+=1); } return total Would really appreciate some pointers, I can't seem to crack this. So for instance, in a row where two of the variables in the 'array' were null I would expect/need it to return '1' (the number of non-nulls)... equally if one of the variables were null I would need it to return '2'. Thanks!
... View more
02-21-2020
05:21 AM
|
0
|
1
|
708
|
POST
|
Thanks Dan! I suspected it would be something so simple.
... View more
08-07-2017
07:07 AM
|
0
|
1
|
435
|
POST
|
Hi! I'm trying to run a field calculator statement to fill an integer field based on a preceding text field - so depending on what the text is, a certain number will be assigned to it. However, the field calculator statement I'm using only seems to work if the text has no spaces in it... any help with this would be greatly appreciated! The expression is: Reclass(!Typology!) And the code black is: def Reclass(Typology): if Typology is "Allotments": return 0.30 elif Typology is "Amenity Green Space": return 0.40 elif Typology is "Park and Recreation Ground": return 1.65 etc. However, in the example above, only allotments will be assigned the requested number. If I removed the spaces from the other text, the calculation works but this isn't acceptable for what I need. Many thanks in advance. Luke
... View more
08-07-2017
04:29 AM
|
0
|
5
|
653
|
POST
|
Thank you so much Joshua, this very neat bit of code did the job perfectly!
... View more
07-11-2017
04:50 AM
|
0
|
0
|
934
|
POST
|
Hi Vince, thanks for your suggestion. How would I enter this code? Is this something that can be used in the Field Calculator?
... View more
07-07-2017
07:13 AM
|
0
|
6
|
933
|
POST
|
Hi Joshua, I'm putting this in: mean([ !Welcoming!, !Access!, !Community!, !Safe!, !Provision!, !Quality!, !Security!, !Dog!, !Litter!, !Grounds! ])
... View more
07-07-2017
06:22 AM
|
0
|
1
|
1091
|
POST
|
I am trying the following but still not having any success: def mean(Welcoming, Access, Community, Safe, Provision, Quality, Security, Dog, Litter, Grounds):
fieldList = [Welcoming, Access, Community, Safe, Provision, Quality, Security, Dog, Litter, Grounds]
validList = []
for i in fieldList:
if i != None:
validList.append(i)
meanVal = sum(validList)/len(validList)
return meanVal I get an error that 9 required positional arguments are missing. Any suggestions please? [edited to use Python syntax highlighting, with proper indent - VA]
... View more
07-07-2017
06:10 AM
|
0
|
3
|
1091
|
POST
|
Hi Joe, I'm looking for statistics to be done on a field array, not only one field. So each feature has ten fields that may or may not be null... I want a script that figures out how many are null to then sum and correctly produce the mean (e.g. if only 8 of the 10 fields are scored, the sum of those will be divided by 8). If you're answer addresses this, please could you rephrase it as I don't follow it.
... View more
07-07-2017
05:58 AM
|
0
|
0
|
1091
|
POST
|
Thanks Dan, I'm not sure I fully follow you. The data source is a featureclass attribute table and ideally I'd be looking to use the Field Calculator or a python script to find the means. Unfortunately, I really don't follow the code block you've copied in, can you suggest how I might make use of it? I had thought numpy might be the answer.
... View more
07-07-2017
05:53 AM
|
0
|
0
|
1091
|
POST
|
Hello, I'm stumped by a problem that I think should have a fairly straightforward answer... I have a few hundred features with a number of attributes, all numerical. Some features have all attributes filled in, but some have a handful of null values. Is there any way of calculating the mean value for each feature that takes into account these null values? For instance, it calculates how many attributes are not null for each feature and uses that to generate the mean? Would really appreciate any help on this! Thanks
... View more
07-07-2017
05:14 AM
|
0
|
20
|
3551
|
POST
|
I seem to have fixed it by using the 'Make Feature Layer' tool as an intermediary - the field value tool is happy with a feature layer, just not a feature class.
... View more
11-25-2016
03:23 AM
|
0
|
1
|
2025
|
POST
|
Hi, I have the following model set up: but whenever I try to change the input feature class my model won't run because of the following errors: How do I set up this tool so that it accepts feature classes? Am I doing something obviously wrong here?? Thanks!
... View more
11-25-2016
02:05 AM
|
0
|
1
|
2025
|
POST
|
Hi Xander, Thanks for your help. I'm having trouble with it though - doesn't a field filter decide what type of field can be allowed rather than letting you specify actual field names? I want a tool where you specify the dataset that needs buffering and then specify the relevant field name that contains the information that will drive the buffer sql expression. I can't see how to do this using the help page you've posted? I'd really appreciate your thoughts as it's driving me mad! Luke EDIT: I've found a way to do it using the 'Get Field Value' Utility... but this only accepts tables as inputs, not feature classes. How can I extract field values from feature classes?
... View more
11-24-2016
07:28 AM
|
0
|
2
|
2025
|
POST
|
Hello, I'm trying to build a model that can take any feature class loaded in and then have the field names available as a user-selected variable which will then power a bunch of geoprocessing tools. How do I set this up so that I can choose the dataset and then the appropriate field name before pressing run on the model? Thanks! Luke
... View more
11-24-2016
03:24 AM
|
0
|
8
|
4850
|
POST
|
Hi Jayanta, Thanks for your reply. Unfortunately whenever I run this I get the following error: ERROR 999999: Error executing function. Objects in this class cannot be updated outside an edit session [photo_merge_test] Failed to execute (Merge). I'm really quite stuck on this. Is there an alternative way to merge attachment datasets? EDIT: I have since been successful by using the "Append" tool in Pro. Don't know why the Merge tool failed, but the end effect is the same!
... View more
10-26-2016
05:45 AM
|
0
|
0
|
655
|
Online Status |
Offline
|
Date Last Visited |
09-06-2022
01:29 PM
|