Select to view content in your preferred language

Smart Forms Calculated Expressions not populating in Field Maps

1054
4
Jump to solution
09-16-2022 03:15 PM
NathanGEOregon
Occasional Contributor

I've created a Smart Form for filling in new fields for existing features in a hosted feature layer. For a couple of the fields, I want the forms to pre-populate an existing domain value.

DomainName($feature, 'UTIL_MAT_CLAS_BAS',1)

The "Test" button populates the correct value of "Field inspection only with no records". And editing a feature in a Web Map populates the correct value.

But editing a feature in Field Maps just gives  "--" in the field.

I've even attempted replacing the domain value strictly with the text "Field inspection only with no records" with the same result.

Is this a Field Maps bug, or is there something else going on?

 

0 Kudos
1 Solution

Accepted Solutions
NathanGEOregon
Occasional Contributor

A coworker helped me resolve the issue. As the other person mentioned:

DomainName($feature, 'UTIL_MAT_CLAS_BAS',1)

returns the domain description as text, and the field was set up as short integer coded domain values. Even though the above worked perfectly in a web map, it didn't work in Field Maps. 

Even using: DomainCode($feature, 'UTIL_MAT_CLAS_BAS',1)

returned the Domain Code as text. So I had to add one last piece to convert the text to a number:

Number(DomainCode($feature, 'UTIL_MAT_CLAS_BAS',1))

The above successfully populated the field in Field Maps, and even displayed the domain description in the form.

View solution in original post

4 Replies
RhettZufelt
MVP Notable Contributor

Do you actually have subtypes? 

what happens if you remove the ",1" from the end?

R_

0 Kudos
NathanGEOregon
Occasional Contributor

I have domain values. The "1" is telling it which domain value to pull. If you remove the "1" the result is Null

0 Kudos
RhettZufelt
MVP Notable Contributor

Documentation says that is for subtypes.  If I put:

 

DomainName($feature, 'FieldName')

 

I get the domain description (not code) that is stored in that field for that feature.

I added a dataset with subtype(s), but can't figure out how to get AGOL to honor them.  Even the templates ignore the subtypes settings, so, if you are dealing with them, I'm not going to be of any help.

Good luck,

R_

0 Kudos
NathanGEOregon
Occasional Contributor

A coworker helped me resolve the issue. As the other person mentioned:

DomainName($feature, 'UTIL_MAT_CLAS_BAS',1)

returns the domain description as text, and the field was set up as short integer coded domain values. Even though the above worked perfectly in a web map, it didn't work in Field Maps. 

Even using: DomainCode($feature, 'UTIL_MAT_CLAS_BAS',1)

returned the Domain Code as text. So I had to add one last piece to convert the text to a number:

Number(DomainCode($feature, 'UTIL_MAT_CLAS_BAS',1))

The above successfully populated the field in Field Maps, and even displayed the domain description in the form.