Select to view content in your preferred language

PullData @Layer - Domain Description VERSUS Code

608
2
Jump to solution
04-08-2024 11:44 AM
ModernElectric
Frequent Contributor

I am working on reworking my code in a series of my Survey123 forms/templates. Before, I made an AGOL table and pulled information from that. I am rebuilding the forms to use the PullData function to autopopulate the fields looking at a Hosted Feature Layer. The fields that are being populated have domains and when I run the form, the Domain Code is autopopulate VERUS the Domain Description. If I am pulling the Manufacture, I am seeing 511, but need to see the description (ACC).

From Spreadsheet (Calculation Field)

pulldata("@layer", "getValue", "attributes.XFMR_MANUFACTURER", ${hfl_url}, ${where_clause})

Is there something I am missing?

Thank You

1 Solution

Accepted Solutions
ZacharySutherby
Esri Regular Contributor

Hello @ModernElectric

The pulldata("@layer") function returns the result from the Query REST API, which will only return domain codes and not labels. 

To obtain the domain label a queryDomains API call would need to take place and match the code returned with the code in the response of the queryDomains request. I've logged feedback internally to investigate if this is something we can add to the pulldata("@layer") function in the future. 

At this time to return the domain label you can do a couple of things: 

- Use a custom JavaScript function to do the queryDomains REST API call and return the matched domain label 

- Duplicate your domain as a choice list in the choices worksheet of your XLSForm, set the question you are doing the pulldata("@layer") lookup to a select_one question so the result from the lookup matches a choice name in your choices worksheet, then in your original question you need to return the label use the jr:choice-name() function to return the label from your choice list. 

Thank you,
Zach

View solution in original post

2 Replies
ZacharySutherby
Esri Regular Contributor

Hello @ModernElectric

The pulldata("@layer") function returns the result from the Query REST API, which will only return domain codes and not labels. 

To obtain the domain label a queryDomains API call would need to take place and match the code returned with the code in the response of the queryDomains request. I've logged feedback internally to investigate if this is something we can add to the pulldata("@layer") function in the future. 

At this time to return the domain label you can do a couple of things: 

- Use a custom JavaScript function to do the queryDomains REST API call and return the matched domain label 

- Duplicate your domain as a choice list in the choices worksheet of your XLSForm, set the question you are doing the pulldata("@layer") lookup to a select_one question so the result from the lookup matches a choice name in your choices worksheet, then in your original question you need to return the label use the jr:choice-name() function to return the label from your choice list. 

Thank you,
Zach
ModernElectric
Frequent Contributor

@ZacharySutherby 

Appreciate your help. 

My work around has been to make a stand-alone table in ArcGIS Pro and replace the domain with basic attributes. This, however is a process. I am in the process of writing a script that will do this automatically thru Python.

Not having the knowledge in Java Script, I will have to learn. 

I will experiment more. Appreciate you escalating the request.

0 Kudos