Output field label AND name [using calculations on geopoints]

1074
4
Jump to solution
03-30-2021 03:04 PM
JulietK
Occasional Contributor II

Hi, I am looking for a way to retain both the text name of a field select_one choice, as well as the geopoint information for the choice. 

I'm using the 'Calculations on Geopoints' method in my xlsform, which uses geopoints in the name column.

The fields in the xlsform look like the below:

JulietK_1-1617141455590.png

My choices list for the fields look like this:

JulietK_0-1617141407667.png

I am wanting to have my survey output datasheet include the label somehow, so that I can make charts on the Dashboard using the text label names (e.g. Site A, Building 1 etc). However obviously since the name column is what is shown in the output datasheet, all I see in the datasheet is the geopoint information. 

Is there a way to set up a separate hidden field somehow to pull the labels rather than the name? 

0 Kudos
1 Solution

Accepted Solutions
Jim-Moore
Esri Regular Contributor

Hi @JulietK the label for a choice can be retrieved using the jr:choice-name() function, as shown in the table of supported functions in the Formulas documentation. Please also refer to this note in the Cascading and external selects documentation.

For example, for the Workarea select_one question, you could store the label in another question using a calculation like:

jr:choice-name(${Workarea}, '${Workarea}')

Hope this helps. Best, Jim

View solution in original post

4 Replies
Jim-Moore
Esri Regular Contributor

Hi @JulietK the label for a choice can be retrieved using the jr:choice-name() function, as shown in the table of supported functions in the Formulas documentation. Please also refer to this note in the Cascading and external selects documentation.

For example, for the Workarea select_one question, you could store the label in another question using a calculation like:

jr:choice-name(${Workarea}, '${Workarea}')

Hope this helps. Best, Jim

JulietK
Occasional Contributor II

Hi Jim,

Perfect, thank you so much! 

Quick question, would the jr:choice-name() function work within a if(selected()) formula? For example, if I had 2 separate fields Workarea1 and Workarea2 (only one of either are available in a survey depending on previous selections, both are set as bind::esri:fieldType null), and I wanted to pull only the labels into one single field? 

e.g. if(selected(${previousfield}, 'choice1'),jr:choice-name(${Workarea1}, '${Workarea1}'),jr:choice-name(${Workarea2}, '${Workarea2}'))

0 Kudos
Jim-Moore
Esri Regular Contributor

Hi @JulietK yes the jr:choice-name() function should work inside an if() statement and your example looks good to me.

Best, Jim

JulietK
Occasional Contributor II

Excellent, thank you so much for your advice!