Error “The selected function was provided the incorrect number of arguments”

commcare

I have the following expression and keep getting an error message that says: "The selected function was provided the incorrect number of arguments"

concat(if(selected( danger_signs, 'convulsions_unconsciousness'), "Convulsions or Unconsciousness,", ""), if(selected( danger_signs, 'headaches_vision'), "Headaches or Blurred Vision,", ""), if(selected( danger_signs, 'vaginal_bleeding'), "Vaginal Bleeding,", ""), if(selected( danger_signs, 'vaginal_discharge'), "Vaginal Discharge,", ""), if(selected( danger_signs = 'swelling_face_hands'), "Swelling face or hands,", ""), if(selected( danger_signs, 'fever'), "Fever,", ""), if(selected( danger_signs, 'breaking_water'), "Breaking Water,", ""), if(selected( danger_signs, 'abdominal_pain'), "Abdominal Pain,", ""), if(selected( danger_signs, 'excessive_tiredness'), "Excessive tiredness,", ""), if(selected( danger_signs, 'lower_leg_pain'), "Lower leg pain,", ""), if( urinary_urgency = 'yes', "Urinary Urgency,", ""), if( referral_reason_other = "", "", "Other:"),  referral_reason_other)

Best Answer

The wording is weird on this error message. It means that the selected function was provided the wrong number of arguments. If you look at your expression, you will see a chunk that says:

selected( danger_signs = 'swelling_face_hands')

However, selected takes two arguments, and you have only provided 1. Perhaps you meant:

selected( danger_signs, 'swelling_face_hands')