Multiple choice option in Field Maps

9435
28
10-06-2021 08:30 AM
Status: Open
Labels (1)
ZoeBroek
Occasional Contributor

I'd like to have a multiple choice option in Fieldmaps. The current version of Field Maps (Oct 2021) has  limited options for data collection. When collecting an attribute value I sometimes need people to fill in multiple values form the same domain list. I'd like them to be able to select multiple values from the combobox or radio buttons. 

I'm hoping this function will be added with the new function of creating elements form scratch (kinda like the different options in de survey123, preferably the Multiple Choice) but also not like that, because I need them to use my domain values and not create a new field.

Does anyone have a smart workaround for this in the meantime? 

28 Comments
JustinMiller2

Agreed

This is vital for so many usecases of FieldMaps including environmental surveys.
PLEASE implement this asap.

JenniferEvershed1

Yes would absolutely love to see this! It would make species data collection so much easier.

Just one example: conducting a field assessment with Emergent species, 3x Tree level species, 2 x Shrub level species and 1 x ground level species.  I currently have text boxes for each species so that users can enter multiple species in each field (e.g. Tree Level 1: species 1, species 2, species 3. Tree Level 2: species 1, species 2, species 3 etc. )

This means users have to type out the species names each time which is time consuming and error prone. I'd love to use Domains however then I would need to have Tree Level 1, species 1; Tree Level 2, species 2; Tree Level 1, species 3; Tree Level 2, species 1 etc. which is just way too many fields and still restricted by the number of fields I decide to make.

I can see requests for multi select are going back to 2017 can we please please get this into Field Maps?  Survey123 just isn't always suitable.  In this case, the rest of the survey is best captured in Field Maps so to then set up a separate Survey123, have the users flicking between apps in the field and then have to manage the data separately and bring it all back together at the end is just another series of time sucks. 

Multi Select for Field Maps please!!

JustinReynolds

I would also like to see a multiple choice option with native support as well.

For those looking for another example of the workaround that uses two fields see below.

FM_Multiple_Choice_Workaround_Compressed.gif

Compact Code

// example_multiple_choice_list_workaround

var self = $feature.fdt_fill_compact_equip_used;
var pEquipCode = $feature.fdt_fill_compact_equip;
var pEquipDesc = DomainName($feature, "fdt_fill_compact_equip");
var delimeter;

if (IsEmpty(pEquipCode) && IsEmpty(self)){return}; // There is nothing to do... exit early
if (pEquipCode == 0){return}; // Clears the list & exits early

if (!IsEmpty(pEquipCode)) {
    IIF(Find(pEquipDesc, self) == -1, pEquipDesc, pEquipDesc = Null);
    IIF(IsEmpty(self) || IsEmpty(pEquipDesc), delimeter = '', delimeter = ', ')
};
return self + delimeter + pEquipDesc

Same code with comments and context

/* example_multiple_choice_list_workaround

LOGIC:
    CORE:
        Build a comma seperated list based on repeated
        selections from the compaction equipment field
        --> faking a multi-select field
        
        Clear the current list if 0 is selected
        
        *9999 will allow the user to manually edit this field
         That is handled via an editableExpression

ASSIGNED TO:
    Field -> $feature.fdt_fill_compact_equip_used

DOMAIN EXAMPLE:
    1       Jumping Jack
    2       Impact Roller
    3       Grid Roller
    4       Sheepsfoot Roller (Vibratory)
    0       Clear the List
    9999    Manual Entry
*/

var self = $feature.fdt_fill_compact_equip_used;
var pEquipCode = $feature.fdt_fill_compact_equip;
var pEquipDesc = DomainName($feature, "fdt_fill_compact_equip");
var delimeter;

// var self = 'Jumping Jack'; // TEST VALUE
// var self = 'Jumping Jack, Impact Roller'; // TEST VALUE
// var pEquipCode = 0; // TEST VALUE
// var pEquipDesc = 'Impact Roller'; // TEST VALUE

Console('Current Equipment: ' + self);
Console('Proposed Equipment: ' + pEquipDesc);

if (IsEmpty(pEquipCode) && IsEmpty(self)){return}; // Exits early
if (pEquipCode == 0){return}; // Clears the list & exits early

if (!IsEmpty(pEquipCode)) {
    // If pEquipDesc already in self, don't add it again.
    IIF(Find(pEquipDesc, self) == -1, pEquipDesc, pEquipDesc = Null);
    
    // If either self or pEquip is null then a comma is not needed.
    IIF(IsEmpty(self) || IsEmpty(pEquipDesc), delimeter = '', delimeter = ', ')

};
return self + delimeter + pEquipDesc

 

And as a bonus... setting up the editable expression.

1. Create a visibility expression that will instead be used to control editability (which will enable or disable the calculated expression).

Notice the vis condition below that is not assigned to anything.

JustinReynolds_0-1671646255754.png

The editableExpression (created as if it were a visibleExpression).

/* edt_fdt_fill_compact_equip_used

LOGIC:
    CORE:
        Enable editing of the fdt_fill_compact_equip_used
        if compaction equip pick list is set to 
        9999 => Manual Entry

ASSIGNED TO:
    Field --> $feature.fdt_fill_compact_equip_used
*/

var valueField = 'fdt_fill_compact_equip';
var field = 'fdt_fill_compact_equip_used';

Console('Enable/Disable Editability on ' + field);
var value = $feature[valueField];
// var value = 9999; // TEST VALUE

IIF(value == 9999, True, False)

 

And finally, creating the editableExpression on the field in the web map's JSON using AGOL Assistant.

JustinReynolds_1-1671646766261.png

 

 

AnthonyJonesRSK

@Woodpecker @JustinReynolds 

Just wanted to say thanks to both of you for posting details of your workarounds, that worked a treat. Whilst I'm hoping Esri implement something akin to the Survey123 options soon this will do for now. 

It's also made me aware of being able to toggle a fields editability by editing the json and using a conditional arcade expression, which I didn't know you can do. I've had a couple of issues getting mine working but will persevere with it. Cheers

DavidSolari

I'd expand this to make multi-choice options a full domain type, that way other parts of the platform can edit multiple choice questions. Bonus points if the choices are stored as bit flags if the backing field is an integer, the Survey123 method of concatenating every choice in the backing field seems wasteful when you can shove 16 choices in a short field.

JeffHaney

@JustinReynolds 

Thanks for posting your code example and showing the json layer editing.  That was a new one for me.  

Your code is straight forward, but when trying to implement it I can't get self to retain the prior selection.  If I update the record and then edit it will tack on a new selection.  Its seemingly referencing the attribute value instead of the text box value.  Am I missing something?

Thanks!

Brady
by

@JustinReynolds and any others using this great solution, I couldn't get the clear functionality working with the code using the 0 value even when putting it in the domain.

if (FlwrClrChoice == 0)

but it worked perfectly when I put in 'Clear' as the code and value in the domain and switched it to 

if (FlwrClrChoice == "Clear")

I haven't implemented the visibility component yet but it's all working great.

 

 

JustinReynolds

For those using AGOL, you can now natively author this solution in the Field Maps Designer.  This is because you can now author editability constraints.  For those in Enterprise, hopefully we will see that in 11.1.

JustinReynolds

@JeffHaney It is hard to say without seeing the code.  You can DM me if you don't want to post it here and I can take a look and offer up some advice.

JustinReynolds

@Brady 

What is the field type for the field with the domain?  If you can put 'Clear' as the code it seems it is Text.  My field is a SHORT so I can say something like x == 0.  If it were a TEXT field I would need to use x == '0'.