Inserting calculation function in a note type

I have created a data collection tool for a treatment centre; collecting number of people treated and the number of medicines used for the treatment. The standard process is that the highest number of medicines to be used is 4. However, we noticed that some centres have an average use of medicine above 4.

So I want to create a quality control question (question type - note) that would only pop up when average use of medicine is above 4. This way, each centre would be able to review their data prior to submission.

I'm having a challenge creating this function. The formula (under relevant) I came up with returned "ODK Validate Error". Please see a snapshot below. I need help with the red highlighted row

${iv_avg} > 4 try this instead of (${iv_avg}) > {4}
Remove required yes for Note question. Its not necessary, note is label not a question.

Thank you @Prashant_K . It did not work. It still returned a validate error.

The required yes is necessary. It ensures that if the relevant is true, the data collector will not be able to move the next question.

what is the output of calculate "iv_avg" you are see on next note question?

If possible upload excelsheet so that we can try to replicate error.

You can't make a note required as there's no way to enter a response for a note. Edit: Incorrect. Notes are read only but can be made required which will block progress unless it also has a default value

I think another way to achieve what you desire is to use the trigger widget, but make it read only as well as required. This will let you use relevance (>4) to show the item & error message.

As it's a user input widget you can set it to be required, so the user cannot proceed without answering, but it's read only, so it's impossible to answer - the only way to proceed is to go back and adjust such that iv_avg is <= 4, making relevance false and removing the item.


@ahblake , thank you so much for your help. The trigger widget worked for what I want. I would like to point out that you can make a note required provided based on the context where I used it. I'm attaching the form for reference.

@Prashant_K , the form is attached.
sample.xlsx (11.1 KB)

apologies, you are right, and it's an existing issue

You ought to be able to fix your relevant and use it on the note that is required and that will also work as you desire.

@ahblake your solution is correct.
@ahblake My contribution of addition is that you can make a note type compulsory (yes).
@ayowumi I hope the challenge is solved.

Apologies for late reply.

@ayowumi kindly DM via mail for collaboration.

I look forward to hearing from you.