The goal is to populate a popup in an online map that contains data from a related table. Each record will have two related records, one for each end of the feature. I have it so the data will populate, but now I need to make it so the Domain Description displays as opposed to the Domain Code. The code is as follows:
Which provides the following (red text = field with domains):
Culvert ID: {0A5BF456-57EC-4655-BD62-B153208EB3C5}
Bound: no data
Condition Index: no data
Embankment Condition: no data
End Extension: 2
End Location: no data
End Section: 7
End Section Detached: 2
End Section Material:
Extension Dime Same as Culvert: no data
Extension Material Same as Culvert: no data
Footing Exposed: 2
Install Year: no data
Invert Above Channel Bottom: 2
Scour Protection Type: no data
Rip Rap: 2
Rip Rap Condition: no data
Safety Grate: 2
Scour: 2
Sediment Depth >20: 2
End Section Extension Length (ft): no data
End Section Remarks: no data
Field Vertification Date: 2022-02-23T13:41:54-05:00
Inventory Field Verification User: Kyle Staines
Field Verification Company: 2
User Create: no data
System Create Date: no data
User Modified: MdotPublisher
System Modified Date: 2022-02-23T13:42:04-05:00
Culvert ID: {0A5BF456-57EC-4655-BD62-B153208EB3C5}
Bound: no data
Condition Index: no data
Embankment Condition: no data
End Extension: 2
End Location: no data
End Section: 7
End Section Detached: 2
End Section Material:
Extension Dime Same as Culvert: no data
Extension Material Same as Culvert: no data
Footing Exposed: 2
Install Year: no data
Invert Above Channel Bottom: 2
Scour Protection Type: no data
Rip Rap: 2
Rip Rap Condition: no data
Safety Grate: 2
Scour: 2
Sediment Depth >20: 2
End Section Extension Length (ft): no data
End Section Remarks: End section showing rebar
Field Vertification Date: 2022-02-23T13:42:36-05:00
Inventory Field Verification User: Kyle Staines
Field Verification Company: 2
User Create: no data
System Create Date: no data
User Modified: MdotPublisher
System Modified Date: 2022-02-23T13:42:46-05:00
So, I need the fields in red above to populate the domain name rather than code. Any help is appreciated!
Solved! Go to Solution.
I think you just need to use the DomainName function in those places. On lines like
"Condition Index: "+ DefaultValue(f.ConditionIndex, 'no data')
Try using the function there, like so:
"Condition Index: "+ DefaultValue(DomainName(f, 'ConditionIndex'), 'no data')
I see a couple other places where you are using the function, but you're supplying a FeatureSet as the input. To get a particular value's name, you need to supply a single feature. So instead of this:
DefaultValue(DomainName(features, 'EndLocation')
Try this:
DefaultValue(DomainName(First(features), 'EndLocation')
Lastly, for putting together long strings with lots of attributes inserted, you might want to try using template literals. It avoids having to concatenate so many strings, and respects line breaks. It would look like this:
`Culvert ID: ${DefaultValue(f.CulvertID, 'no data')}
Bound: ${DefaultValue(f.Bound, 'no data')}
Condition Index: ${DefaultValue(f.ConditionIndex, 'no data')}
Embankment Condition: ${DefaultValue(f.EmbankmentCondition, 'no data')}
... and so on
`
I think you just need to use the DomainName function in those places. On lines like
"Condition Index: "+ DefaultValue(f.ConditionIndex, 'no data')
Try using the function there, like so:
"Condition Index: "+ DefaultValue(DomainName(f, 'ConditionIndex'), 'no data')
I see a couple other places where you are using the function, but you're supplying a FeatureSet as the input. To get a particular value's name, you need to supply a single feature. So instead of this:
DefaultValue(DomainName(features, 'EndLocation')
Try this:
DefaultValue(DomainName(First(features), 'EndLocation')
Lastly, for putting together long strings with lots of attributes inserted, you might want to try using template literals. It avoids having to concatenate so many strings, and respects line breaks. It would look like this:
`Culvert ID: ${DefaultValue(f.CulvertID, 'no data')}
Bound: ${DefaultValue(f.Bound, 'no data')}
Condition Index: ${DefaultValue(f.ConditionIndex, 'no data')}
Embankment Condition: ${DefaultValue(f.EmbankmentCondition, 'no data')}
... and so on
`
Many thanks!