Hi everyone
I am relatively new in survey123 and i am struggling to achieve something if anyone can help.
The concept is very simple.
Based on the answer above i want the ID to start with either TP-(numbers) or BM-(numbers) depending what the feature is. Alphanumerical ID
i am using this calculation but no luck for sometime now.
if(selected(${Feature_Type}, 'Trial Pit', concat('TP', '-', ${Feature_Type}))), concat('BM', '-', ${Feature_Type})
i would really appreciate any help.
Thank you
Solved! Go to Solution.
Your parentheses are off and you are using selected a bit off.
You can do selected(question, value) or question = value but you have them intermixed.
if(selected(${Feature_Type}, "Trial Pit"), concat('TP', '-', ${Feature_Type}), concat('BM', '-', ${Feature_Type}))
or
if(${Feature_Type} = "Trial Pit", concat('TP', '-', ${Feature_Type}), concat('BM', '-', ${Feature_Type}))
Note this will give you BM- even when the field is empty. If you want it to stay blank until they pick something you can do.
if(selected(${Feature_Type}, "Trial Pit"), concat('TP', '-', ${Feature_Type}), if(selected(${Feature_Type}, "Bellmouth"), concat('BM', '-', ${Feature_Type}), "")
Hope that helps
I am struggling with any number of issues as well, but in this one I thin it might be an out of place coma.
if(selected(${Feature_Type} = "Trial Pit", concat('TP', '-', ${Feature_Type}))), concat('BM', '-', ${Feature_Type})
for if (condition, TRUE, FALSE)
Your parentheses are off and you are using selected a bit off.
You can do selected(question, value) or question = value but you have them intermixed.
if(selected(${Feature_Type}, "Trial Pit"), concat('TP', '-', ${Feature_Type}), concat('BM', '-', ${Feature_Type}))
or
if(${Feature_Type} = "Trial Pit", concat('TP', '-', ${Feature_Type}), concat('BM', '-', ${Feature_Type}))
Note this will give you BM- even when the field is empty. If you want it to stay blank until they pick something you can do.
if(selected(${Feature_Type}, "Trial Pit"), concat('TP', '-', ${Feature_Type}), if(selected(${Feature_Type}, "Bellmouth"), concat('BM', '-', ${Feature_Type}), "")
Hope that helps
thank you so much Doug, i slightly amended your formula and it did do what i needed.
i really appreciate your time to help.