AnsweredAssumed Answered

Syntax of subtype values in codeblock

Question asked by Koelker12 on Aug 23, 2017
Latest reply on Aug 23, 2017 by Koelker12

I have a pair of data sets with identical schemes; one is a sort of reference layer (A) and the other one is an editable working layer (B). These data sets eventually make their way into a web map for Collector. There is a field using subtypes that help restrict domains for other fields, which looks like:


4Generic Karst


My workflow includes appending the data in layer (B) to layer (A). The problem is that the subtype field displays its numeric code instead of its description in pop-ups for the web map. For ease of use I need the description to display, so I wanted to calculate the description into a second text field. Eventually this will be a python script, but for testing purposes I've been using the field calculator in ArcMap to check that the code is right before I incorporate it into my larger script. The below example successfully runs without error, but instead of returning the description in my "if" statement, I'm always getting the "else: nope". 


Pre-logic script code

def myFunc(ftype_int):
   if (ftype_int == 4):
      return "Generic Karst"
      return "nope"



In place of the (ftype_int == 4) I've tried (ftype_int == "4"), (ftype_int == "Generic Karst"), (ftype_int == "4 - Generic Karst"), but# have had no luck. 


How do I get the field calculator to properly read the values in the subtype field? Hope this makes sense.