Create a new Hosted Feature Service Domain Type: codedvalueMultiSelect

783
0
04-12-2019 09:14 AM
Status: Open
JohnMDye
Occasional Contributor III

Currently, ArcGIS Applications other than Survey123 are unable to support multi-value selected due to limitations on the Hosted Feature Service definition. That is, there is no way to indicate whether or not a value should be 'selected' or  'unselected' because such a value type does not exist within the hosted service definition.

Take this 'Payment Forms' field I created in a Hosted Feature Service as an example:

{
 "name" : "PAYMENT_FORMS", 
 "type" : "esriFieldTypeString", 
 "alias" : "Accepted forms of payment", 
 "sqlType" : "sqlTypeOther", 
 "length" : 50, 
 "nullable" : false, 
 "editable" : true, 
 "visible" : true, 
 "domain" : 
 {
 "type" : "codedValue", 
 "name" : "Point layer_PAYMENT_FORMS_8ff94d6b-7b8c-4f0e-8838-2fb72098a535", 
 "codedValues" : [
 {
 "name" : "Cash", 
 "code" : "CASH"
 }, 
 {
 "name" : "Check", 
 "code" : "CHECK"
 }, 
 {
 "name" : "Credit", 
 "code" : "CREDIT"
 }, 
 {
 "name" : "Money Order", 
 "code" : "MNY_ORDER"
 }, 
 {
 "name" : "Certified/Cashier's Check", 
 "code" : "CERT_CHECK"
 }, 
 {
 "name" : "Debit", 
 "code" : "DEBIT"
 }, 
 {
 "name" : "Wire Transfer", 
 "code" : "WIRE_XFER"
 }, 
 {
 "name" : "Apple Pay", 
 "code" : "APPLE_PAY"
 }, 
 {
 "name" : "Google Pay", 
 "code" : "GOOGLE_PAY"
 }, 
 {
 "name" : "Venmo", 
 "code" : "VENMO"
 }, 
 {
 "name" : "Zelle", 
 "code" : "ZELLE"
 }
 ]
 }, 
 "defaultValue" : "CASH", 
 "description" : "null"
 }

I think anyone looking at the list of values above could see what one would normally be trying to do here. Offer a list of values from which multiple could be selected or unselected, depending on the forms of payment a vendor accepted. However, it's not possible to do this with the current Hosted Service definition.

What I'm proposing is that the the 'codedvalue' domain type be forked, to create a  'codedvalueMultiSelect' domain type. Such a domain type would be identical, except that it would add a new boolean property ('isSelected') would be added to each name-code pair in the 'codedValues' array. Which would result in this structure for the above example:

{
 "name" : "PAYMENT_FORMS", 
 "type" : "esriFieldTypeString", 
 "alias" : "Accepted forms of payment", 
 "sqlType" : "sqlTypeOther", 
 "length" : 50, 
 "nullable" : false, 
 "editable" : true, 
 "visible" : true, 
 "domain" : 
 {
 "type" : "codedvalueMultiSelect", 
 "name" : "Point layer_PAYMENT_FORMS_8ff94d6b-7b8c-4f0e-8838-2fb72098a535", 
 "codedValues" : [
 {
 "name" : "Cash", 
 "code" : "CASH",
 "isSelected" : true
 }, 
 {
 "name" : "Check", 
 "code" : "CHECK",
 "isSelected" : true
 }, 
 {
 "name" : "Credit", 
 "code" : "CREDIT",
 "isSelected" : true
 }, 
 {
 "name" : "Money Order", 
 "code" : "MNY_ORDER",
 "isSelected" : false
 }, 
 {
 "name" : "Certified/Cashier's Check", 
 "code" : "CERT_CHECK",
 "isSelected" : false
 }, 
 {
 "name" : "Debit", 
 "code" : "DEBIT",
 "isSelected" : true
 }, 
 {
 "name" : "Wire Transfer", 
 "code" : "WIRE_XFER",
 "isSelected" : false
 }, 
 {
 "name" : "Apple Pay", 
 "code" : "APPLE_PAY",
 "isSelected" : true
 }, 
 {
 "name" : "Google Pay", 
 "code" : "GOOGLE_PAY",
 "isSelected" : true
 }, 
 {
 "name" : "Venmo", 
 "code" : "VENMO",
 "isSelected" : false
 }, 
 {
 "name" : "Zelle", 
 "code" : "ZELLE"
 "isSelected" : true
 }
 ]
 }, 
 "defaultValue" : "CASH", 
 "description" : "null",
 "isSelected" : true
 }

As you can see, the only things that have changed are that domainType has changed to 'codedvalueMultiSelect' and each item now has a boolean 'isSelected' property which is set to either true or false, depending on whether or not that value should display as selected.

This structure would allow other ArcGIS applications such as Collector, Workforce, OpsDashboard, WebApp Builder, Configurable Apps and pretty much all others to start supporting the much desired 'multi-select' functionality without having to do any weird CSV parsing or custom syntax management. All they need to do is look at the domain type and if it is 'codedvalueMultiSelect', then they need to read the 'isSelected' property for each domain value. From there, they can decide how to display selected and unselected values depending on the experience they want for their application.

Some might offer that this is already supported by Survey123. I realize that. This idea is requesting a new domainType so that other applications can offer the same functionality without having to do the custom CSV parsing that Survey123 does in order to offer that functionality. In fact, I'd wager that if this new domain type were created, Survey123 would switch to use this instead as it would be much easier to work with than what they are doing now. This would also allow multi-select to be supported across the entire ArcGIS Platform in all applications, rather than just in Survey123.