Issue With Dropdown List From Expression Rule and save to CDT

Hello All, 

I am a newbie to the Appian Development.  I am trying to display the results of an expression rule (that is a CDT based on a database view) as choice labels and values and try to save the selected value to another CDT ( database table). The issue that I am facing is I get an error when trying to display it in the form and I get the below message: 

A dropdown component [label=“Mfg Ship Methods”] has an invalid value for “value”. All selected values must be present in the choiceValues array, but value was 000001_AIR USA_A_US and choiceValues was 000001_AIR MEX_A_MEX; 000001_FED_P_FEA.

Here my table CDT already has an existing value of 000001_AIR USA_A_US in the database. Below is my configuration for the dropdown component: 

a!dropdownField(
label:"Mfg Ship Methods",
choiceLabels: if(rule!EXP_GetMfgShipMethods(local!pagingInfo,ri!expediteline.request_line_id).totalCount >0,index(rule!EXP_GetMfgShipMethods(local!pagingInfo,ri!expediteline.request_line_id).data,"mfg_ship_method",null),{}),
choiceValues: if(rule!EXP_GetMfgShipMethods(local!pagingInfo,ri!expediteline.request_line_id).totalCount >0,rule!EXP_GetMfgShipMethods(local!pagingInfo,ri!expediteline.request_line_id).data.mfg_ship_method,{}),
value: ri!expediteline.final_ship_method,
saveInto: ri!expediteline.final_ship_method
)

Any insight is appreciated!

 

Thanks

  Discussion posts and replies are publicly visible

Parents
  • Hi ,

    First thing is DO NOT use the expression to populate your drop down filed. This is a not the best practice especially when the expression get data by querying from DB.

    Do create a load variable and refer the variable in the choice labels and values as required. You can easily debug once you do this change. you can refer those in a text field and see what all values are return to debug.

    The thing to keep in mind for drop down fields is that, the choice labels and choice values should have matching number of elements.
    Also the value you set initially should exists in choice value list.

    Regards
    Suresh
Reply
  • Hi ,

    First thing is DO NOT use the expression to populate your drop down filed. This is a not the best practice especially when the expression get data by querying from DB.

    Do create a load variable and refer the variable in the choice labels and values as required. You can easily debug once you do this change. you can refer those in a text field and see what all values are return to debug.

    The thing to keep in mind for drop down fields is that, the choice labels and choice values should have matching number of elements.
    Also the value you set initially should exists in choice value list.

    Regards
    Suresh
Children