Parameter unit is invalid

Hey guys, I’m trying to extract a real number parameter but I keep getting this error:
Avertissement:Element.GetParameterValueByName l’opération a échoué.
unitType is an invalid unit type. See UnitUtils.IsValidUnitType() and UnitUtils.GetValidUnitTypes().
Parameter name: unitType
image

what is the error shows?

Avertissement:Element.GetParameterValueByName l’opération a échoué.
unitType is an invalid unit type. See UnitUtils.IsValidUnitType() and UnitUtils.GetValidUnitTypes().
Parameter name: unitType

Two things it might be. The ‘cost’ parameter might need to be ‘Cost’ - case sensitivity is important in Dynamo. Another issue is the elements may not have a cost field if they are instances - you may need to get their types first as ‘Cost’ is a type parameter.

1.The parameter’s name is cost (without upper case)
2.Actually the elements that have no cost parameter have no null mention in their case but those that have a cost parameter have a null mention.
3. I created a cost parameter but changed the type to integer and worked perfectly.

1 Like