I want to calculate a filed and struggle to understand how to code the expression.
var TrapType = $feature.Trap_type;
IIf(TrapType = "Trapinator" or "Timms" or "Set & forget" , 'Possum', 'Rat');
What I would like:
If Trap_type= "Trapinator" or "Timms" or "Set & forget" --> Target_specie = 'Possum'
If Trap_type = other stuff --> Target_specie = 'Rat'
Solved! Go to Solution.
// test for equal with ==
// Aracade doesn't have and/or/not, it uses &&/||/!
// test for equality has to be repeated
var TrapType = $feature.Trap_type;
IIf(TrapType == "Trapinator" || TrapType == "Timms" || TrapType == "Set & forget" , 'Possum', 'Rat');
// easier:
IIF(Includes(['Trapinator', 'Timms', 'Set & forget'], TrapType), 'Possum', 'Rat');
# same goes for python, except you can use and/or/not
TrapType = !TrapType!
return 'Possum' if TrapType == 'Trapinator' or TrapType == 'Timms' or TrapType == 'Set & forget' else 'Rat'
# easier:
return 'Possum' if TrapType in ['Trapinator', 'Timms', 'Set & forget'] else 'Rat'
// test for equal with ==
// Aracade doesn't have and/or/not, it uses &&/||/!
// test for equality has to be repeated
var TrapType = $feature.Trap_type;
IIf(TrapType == "Trapinator" || TrapType == "Timms" || TrapType == "Set & forget" , 'Possum', 'Rat');
// easier:
IIF(Includes(['Trapinator', 'Timms', 'Set & forget'], TrapType), 'Possum', 'Rat');
# same goes for python, except you can use and/or/not
TrapType = !TrapType!
return 'Possum' if TrapType == 'Trapinator' or TrapType == 'Timms' or TrapType == 'Set & forget' else 'Rat'
# easier:
return 'Possum' if TrapType in ['Trapinator', 'Timms', 'Set & forget'] else 'Rat'
Thank you soo much!
have a great day too
Lucile