Function to compare 3 values and display result

Help me. i need function to compare if 3 input integers are equal and display a note. here’s the scenario:
i have 3 integer type variables with names: integer.reg; integer.rep; integer.dhi, all of which have to be input by the data collector.

now, i wish to have a function that compares if values entered for all 3 are identical and display a note, indicating whether or not the values match. Please help, am new to this, i tried the below if function but i may have messed up the syntax:

if(${integer.reg}=${integer.rep} and ${integer.reg}=S{integer.dhi},“Values match 100%”,"Values entered do not match)

i want the calculation to post the note: “Values match 100%” if the values are identical, and post the note: “Values entered do not match” if the values entered are different.

i also tried
if(${integer.reg}=${integer.rep}=S{integer.dhi},“Values match 100%”,"Values entered do not match)

not working also

Welcome to the community, @Temwa! You could do it as outlined in the image shared below:

In the survey tab of your XLSForm:

Data entry screen as seen in Enketo: when nothing is entered

Data entry screen as seen in Enketo: when the inputs do not match

Data entry screen as seen in Enketo: when the inputs matches

Reference XLSForm:

Compare 3 Variables.xls (24.5 KB)

1 Like

Welcome @Temwa,
You have a missing, closing " at the end of the 2nd string, before the final ).

2 Likes

Thank you so much. This solved the problem

1 Like