M.App Enterprise Discussions

Discuss topics with other M.App Enterprise Product pioneers and experts to get the most out of it.
Showing results for 
Search instead for 
Do you mean 
Posts: 27
Registered: ‎05-11-2018

Setting combobox to a default value



Is there a way to set the default value on a combobox? box is showing blank when loaded with dropdown values populated.

I would like to show the value recorded in the database.


<FormField name="LITTER_ROAD" label="ROAD GRADE" editable="true" visible="true" datatype="string" lov="SQL[SELECT LTRIM(RTRIM(ID)), LTRIM(RTRIM(GRADE)) FROM WMS_GRADE]" defaultvalue="SQL[select LTRIM(RTRIM(GRADE)) from WMS_GRADE WHERE ID = (SELECT LITTER_ROAD FROM WMS_STREET_SURVEY WHERE ID = {FORM.ID})]" defaultvaluemode="onload" required="false" maxlength="10" persisted="true" saveinsession="false" type="combobox" override="false" />


Thank You


Technical Evangelist
Posts: 741
Registered: ‎11-12-2015

Re: Setting combobox to a default value

Hi Ciaran,


I am not certain from your description if you are referring to an existing feature or a new feature, but given you say 'value recorded in the database' I am assuming this is an existing feature.


For that you should Name the field for combobox the database column name. A value specified for defaultvalue is not necessary here. In this way the workflow will populate the combobox field with 'value recorded in the database' for that record. Providing a statement for List of Values will allow for the combo box to still have the various values as selectable options. Here is example of that where value comes up in Combobox (BREAK AND ENTER) from the database record (RUCR_EXT_D) and the field is combobox with 5 possible values shown in .xml and result in the workflow.



<FormField name="RUCR_EXT_D" label="Crime Type" editable="true" visible="true" help="Test of help" datatype="string" defaultvaluemode="onload" lov="SQL[select distinct RUCR_EXT_D from Crime order by RUCR_EXT_D]" required="true" persisted="true" saveinsession="false" type="combobox" override="false" />