Hide Question Based on Username

Hello,

My form has 5 questions and I have 2 user logins.

Question 1,2,3 should be visible when logged in by user 1 and only 4,5 should be visible by user 2.

I want to hide question by user.
How do I do this? Please help.

Thanks,
Sudarshan

Welcome @sudarshan,
Could you provide more details, please:

  • Are you using Collect or Enketo (Webform)?
  • Do you want to hide on server level (submitted data) or filter the question during data entry?
  • What do you mean with “user logins for the form”? Different KoboToolbox accounts?

Generally, in KoboTolbox you cannot directly filter submitted data by different “views” selecting only specific columns/variables (like in relational database systems).
There is only an limited option to filter rows with. permissions.

Design hint: Why not use 2 separate forms? (And merge data externally later if needed.)

Hi @wroos, Thank you for replying.

Are you using Collect or Enketo (Webform)?- Yes webform

Do you want to hide on server level (submitted data) or filter the question during data entry? - During the data entry

What do you mean with “user logins for the form”? Different KoboToolbox accounts? - Yes two different user for particular question view rights.

If you use Collect, you could use the metadata username, but this must be set (manually) in the configuration of the local user device. See XLSForm Docs.

So, you could reference ${username} = … in a relevant clause to filter groups of questions.

As far as I now, the Kobo account user name is not available locally in Collect. @Kal_Lam?

@Kal_Lam. Is it possible to use another account than admin in the local Collect configuration (server) for a form/project?

The following 3 options would work for Collect and also for Enketo (Webform).

  • You could have an initial select_one question for MyUserName in the form and control (constraint) the right entry with a following specific password given to the users.

  • You could also just define 2 different secret passwords/codes to enter given to your different users. And use them for the relevant clause.

  • And in your case, a good option might be to go even with separate forms for the 2 users.

Hint: “Hide” questions per relevant will always only keep data for the (last) relevant questions. So, this is not an option for multiple data entries (users) in separate filtered question groups in the same form.

@sudarshan, as advised by @wroos, you should be able to skip a group with the username metadata defined in your Collect Android App as shown in the image below:

In the survey tab of your XLSForm:

In the choices tab of your XLSForm:

image

Then configure your Collect Android App metadata username as shown in the image below:

Once this is ready, the metadata username should be ready to skip as necessary.

Data entry screen as seen in Collect Android App:

Your username configured in the app is now displayed in the question. This means the skipping should work.

Data entry screen as seen in Collect Android App:

Data entry screen as seen in Collect Android App:

Data entry screen as seen in Enketo:

image

Please note that this feature does not work in Enketo because Enketo does not support the feature metadata username.

Reference XLSForm:

Skip with username.xlsx (24.2 KB)

2 Likes

Dear @Kal_Lam, Thank you for replying.

1 Like