I have points shape file with multiple attribute fields, as below:
In above attribute:
'FID_Net' is 'unique value/subset' and 'class' is the 'value'. And in my new data sheet, the values of column 'class' is not repeating. I have to copy that unique value 'FID_Net' to new field 'New_FID' of only one row which value 'class' is minimum within group 'FID_Net' and rest of others row should be 0 or NULL as in my paper's table (Expected).
A few comments:
You need to use a variable to return the value, not the column name itself
You need and End If at the end of your code
After the Else statement, you need to also use the same variable to return the 0 value
I am assuming that you are using the code block for the field calculation.
set the Expression = result
in the code block (I created fields from your table snapshot)
If [species] = "Pinus" and [class1] = 1 and [condition] ="G" then
result = [ITID]
elseif [species] = "Pinus" and [class1] = 1 and [condition] ="M" then
result = [ITID]
elseif [species] = "Pinus" and [class1] = 2 and [condition] ="G" then
result = [ITID]
elseif [species] = "Pinus" and [class1] = 2 and [condition] ="M" then
result = [ITID]
Else
result = 0
End if
Thank you.
It does not account for only populating one row from each category
There was not a mention of anything like this in your post, and this is a bit vague. Could you be more specific about your comment and just what it is you wish to do?
Jim
@Jim Cousins, I have updated my question and simplified some conditions.
Since you posted this in ArcGIS for Desktop Training , a training space, is this an exercise you are trying to solve? If so, do you have to use a specific set of tools or is everything on the table for use? Are you comfortable with writing or using any Python code?