SO I am looking to do a split on a attribute that looks like 45-4. Now all the attributes have values.
here is my code so far:
import fme import fmeobjects def processFeature(feature): f_type = feature.getAttribute('F_TYP') if f_type: f_type.split('-') Height = f_type[0] Class = f_type[-1] feature.setAttribute("Height", Height) feature.setAttribute("Class", Class) It seems to work but only gives me as an example the height = 4 and the class 4. I guess I need to take everything in front of the dash when it exists for height and everything after the dash for class. I do need the if statement to deal with no values.
أكثر...
here is my code so far:
import fme import fmeobjects def processFeature(feature): f_type = feature.getAttribute('F_TYP') if f_type: f_type.split('-') Height = f_type[0] Class = f_type[-1] feature.setAttribute("Height", Height) feature.setAttribute("Class", Class) It seems to work but only gives me as an example the height = 4 and the class 4. I guess I need to take everything in front of the dash when it exists for height and everything after the dash for class. I do need the if statement to deal with no values.
أكثر...