Can the form version be accessed from inside the form?

Hi,
and is there a way to show the version number within the form? Like through a calculate field calling the version number from within the form?
This way I could generate a message to the enumerator within the questionnaire to check the current version of its form.
Thanks in advance!

No, the version number is only displayed on the list of forms:

1 Like

Thanks @Grzesiek2010, was just hoping it could be used outside.

@Grzesiek2010 is right that it's not a common thing to do but you can in fact get the version number from within the form using an XPath expression that will look like /<form-name>/@version. See an example at https://docs.google.com/spreadsheets/d/1fJMjg9J7xAAaRQwSDQ4J8TlYp8fzHDBtXnPd4QMfy5Y/edit#gid=0

2 Likes

I didn't know it's possible. Thanks!

2 Likes

There's so much to learn, right?! :blush: Glad to be learning with the best community there is.

2 Likes

Thanks @LN, this is great news.

When you write //@version, des is work with form-title, form-id or the file name of the XLS file of the XLSForm?

Also, i I extrapolate this, does this mean we can use the same type of XPath expression for other fields?

1 Like

The node name you need is that of the document root. You can find it by opening up the form XML. If you use XLSForm, by default it matches the filename. If you use Build, by default it is data.

You can use complex XPath expressions in your forms but beware that Collect XPath support isn’t 100% perfect. If you try something that doesn’t work, please open a new support question and someone can either suggest an alternative or see whether it can be made to work.

1 Like

Thanks @LN, very useful!

To build on @LN , a slightly more general purpose solution to getting the form name and form version from 'inside the form' is to use the XPath expressions:

form name: /*[1]/@id

form version: /*[1]/@version

You can use these expressions anywhere, eg calculation, relevent, required, ...

In case yer curious, the first / selects the document root, the *[1] selects the first node under it (which will be your primary form instance), and the @id and @version give you the corresponding property values.

1 Like

Hi,

Version trick works, thanks. Is there a list of variables other than form ID and version that we can get via this method?

Saad

There may be others, depending on precisely what tool generated your form... These are basically XML attributes on the primary instance XML element; see Primary Instance for a list of other possible attributes which may be present (but, again, no guarantee they are specified... eg version is even sometimes absent)

1 Like

@LN @Xiphware

I am looking to find __system_submitterId or __system_submitterName, is there a way to get any of these?

These don't appear to be regular XForm fields; but if you can perhaps post your actual XForm - or XLSForm - definition it should be possible to identify what fields are/not available in it, and possibly how to get to them.

thanks for the quick reply! to give some context: we have 10 teams, we are giving each a public link, each team might have different quantity of surveyors, we are looking to give them the names of their surveyors when they enter their public link, other use case will give them specific codes related to their team.

In the survey tab of your xlsform:

CSV file:
image