Select to view content in your preferred language

Pre-populate form field based off of previous answer

702
1
Jump to solution
08-19-2023 11:27 PM
elpinguino
Occasional Contributor III

Hello,

We are visiting different properties and collecting owner/occupier details. I'm setting up a form in Map Viewer. If the owner is the occupier I'd like for the owner fields to get automatically populated into the occupier details so the surveyor doesn't have to do that themselves. (Some context: owner details are already populated. This is for if surveyors go back into any existing entries and need to fill out occupier details.)

This is the expression I wrote in the Occupier field. I have double checked I don't have any misspells and am using the correct features below.

if ($feature.OwnerIsOccupier=='Yes') {
  return $feature.owners_updated;
} else {
  return "";
}

When I test it /do a run it outputs correctly, but when I go into Map Viewer and enter via the form nothing happens. (Yes, the owner fields are all populated so there is data ready to copy over.) Have I missed something here? This is the guidance I am following.

I have made sure to save the form and map before editing a parcel/going into the form to update the occupier details.

I have this set up as an arcade expression will the user be able to manually override it (type in an answer) if it is empty?

Instead of "" is there a better thing to put there like null?

 

1 Solution

Accepted Solutions
elpinguino
Occasional Contributor III

I wasn't able to solve this the way I wanted to. In the end I hit the road block that calculated expressions in forms are not editable.

Instead I went about it another way. Since this feature layer is used to pass attributes into related table in a form in the Experience Builder I ended up adding all the owner and occupier fields from the feature layer into the table we want to pass the attributes into, hiding these newly added fields in S123 connect (so there isn't extra clutter in the form for the front end user) and then setting up a Selected() expression like this in the calculation field.

if(selected(${Ownerisoccupier},'Yes'), ${PrimaryOwnerFirstName}, ${PrimaryOccupierFirstName})

 

View solution in original post

0 Kudos
1 Reply
elpinguino
Occasional Contributor III

I wasn't able to solve this the way I wanted to. In the end I hit the road block that calculated expressions in forms are not editable.

Instead I went about it another way. Since this feature layer is used to pass attributes into related table in a form in the Experience Builder I ended up adding all the owner and occupier fields from the feature layer into the table we want to pass the attributes into, hiding these newly added fields in S123 connect (so there isn't extra clutter in the form for the front end user) and then setting up a Selected() expression like this in the calculation field.

if(selected(${Ownerisoccupier},'Yes'), ${PrimaryOwnerFirstName}, ${PrimaryOccupierFirstName})

 

0 Kudos