Get username from user account vs username from form metadata

Hi!

I am trying to, based on the username of the enumerator, have some data automatically filled in in the form with the pulldata function and a csv file I created.

It was working alright by adding “username” type of question to the form. However, for an enumerator it didn’t work because he changed his username.

When analyzing the data, I noticed that there’s “username” and there’s “_submitted_by” columns which can differ. Apparently username can be altered by the user within the settings “User and device identity > Form metadata”… But want I really wanted is to use the username of the user account, which can’t be altered and which appears under the “_submitted_by” column.

Any way in which I can call that value in my survey?

Any help is appreciated! Thank you very much!

Welcome to the community, @luisrodx! Are you using the Collect android app to collect the data for your project?

Hi @Kal_Lam ,

Thanks for your reply!

I am still in an experimental phase, so was testing both ODK Collect and Kobo Collect. Will it make a difference in this case? But yes, the data will only be collected through mobile app.

@luisrodx, collecting data with either the KoboCollect app or ODK Collect app is the same and does not affect your collected data.

The username is metadata that will update the database in the server when you have configured the username in your Collect app. You should be able to configure the username in your Collect app as outlined in this support article here. At the same time, you should also be able to configure the metadata setting in the server as outlined here. Please note that both options should be set to get the username to work as expected.

submitted_by, on the other hand, is the information/details showing which user account submitted this information. This is more useful if you share your project with other users through manage permissions or row-level permissions.

Hi @Kal_Lam , thanks again for your reply.

However, I wanted to know if there’s a way to capture in my survey the user account of the person filling it in, instead of capturing the username as I am doing?

Regards.

@luisrodx, could you provide more details so the community could explore how it can be done?

Hi @Kal_Lam , sorry I missed this one. Eventually what I was asking stopped being applicable to my project.

But what I meant was the following:

  1. I can create a note question type to reference the username (metadata obtained from the mobile app). In the label column, I can write: " User: ${username} " and it is shown while the survey is being filled in.

  2. But I would like to know if there’s a way to do the same but with the user account. Something like: User: ${_submitted_by} " → I know this one code does not work… but can I reference the user account somehow?

Thank you for your attention once more.

1 Like