Need to reset the dropdown values with Placeholder when users clicks on Clear button

 Hi ,

I have an interface where drop down values are fetching from web service call with two buttons Search and Clear button.

I want to clear the user selected value from drop down and load with the initial set of values (data from webservice call).

 

When user clicks on Clear button

 

 

 

Thanks

= load(
  local!pagingInfo: rule!RTRR_getDefaultPagingInfo(
    null
  ),

local!AMUList_txt: rule!GLOB_getGISAMUsByOperatingDistrict(
                    operatingDistrict_txt: "Lloydminster Heavy Oil & Gas"
                  ),
  local!AMUSearchArray_txt,
  local!showSearchFields: true(),
  local!AMUArray_txt,
   local!validationError_bool: false,
  local!RoleName,
  local!RoleSearch_txt,
  local!showgrid :false()
  with(

    a!formLayout(
      firstColumnContents: {
        a!linkField(
          links: {
         /* a!documentDownloadLink(a!startProcess(
            cons!CreateHOGLGEExcelReportPM,"",fv!processInfo.pv.Output_document), 
         "Export All Thermal/ EOR LGE to Excel")*/
           a!safeLink(
              label: "Export All Thermal/ EOR LGE to Excel",
              uri: rule!GLOB_createExcelExportLink(
                cons!RTRR_EXCEL_EXPORT_TYPE_HOG_WELL_DECISIONS,
                0
                )
              )
            
          }
        ),
        if(
          local!showSearchFields,
          {
            a!sectionLayout(
              label: "Search Fields",
              firstColumnContents: {
                 
                  {
                    a!dropdownField(
                      label: "AMU",
                      labelPosition: "ADJACENT",
                      required: true(),
                      value:  local!AMUArray_txt,
                      saveInto: {
                         local!AMUArray_txt
                      },
                      placeHolderLabel: cons!GLOB_LABEL_DROPDOWN_PLACEHOLDER,
                      choiceLabels: {
                        local!AMUList_txt
                      },
                      choiceValues: {
                        local!AMUList_txt,
                      }
                    )}},
                     secondColumnContents: {
                
                a!radioButtonField(
                  label: "Role",
                  labelPosition: "ADJACENT",
                  choiceLabels: {"Thermal","EOR"},
                  choiceValues: {
                   "Thermal",
                    "EOR"
                  },
                  value: local!RoleName,
                  saveInto: local!RoleName
                  
                )
              }
                    ),
                      a!sectionLayout(
              secondColumnContents: {
                a!buttonLayout(
                  primaryButtons: {
                    a!buttonWidget(
                      label: "Search",
                      style: "PRIMARY",
                      saveInto: {
                        
                        local!AMUSearchArray_txt << rule!APN_returnFirstInput(
                          local!AMUArray_txt,
                          _
                        ),
                       
                        
                        local!RoleSearch_txt << rule!APN_returnFirstInput(
                          local!RoleName,
                          _
                        )
                        ,
                        local!showgrid << true()
                      },
                      validationGroup:a!validationMessage(if(isnull(local!AMUArray_txt),"Please select an AMU",""))
                    ),
                    a!buttonWidget(
                      label: "Clear",
                      saveInto: {
                       
                         
                         local!AMUSearchArray_txt << rule!APN_returnFirstInput(
                          {},
                          _
                        ),
                        
                        local!RoleSearch_txt << rule!APN_returnFirstInput(
                          null(),
                          _
                        ),
                        local!RoleName << rule!APN_returnFirstInput(
                          null(),
                          _
                        ),
                      }
                    )
                  }
                )
              }
            ),
            {
          
          with(
            /* local!AMUFilters: rule!GLOB_ArrayFilterGeneration(
                valueArray: local!AMUSearchArray_txt,
                operator_txt: "includes",
                field_txt: "AMUNAME"
              ),
              local!ROLEFilters: rule!GLOB_ArrayFilterGeneration(
                valueArray: local!RoleSearch_txt,
                operator_txt: "includes",
                field_txt: "USERROLE"
              ),
              local!AMULogicalExpression: if(
                rule!APN_isEmpty(
                  local!AMUSearchArray_txt
                ),
                null(),
                a!queryLogicalExpression(
                  operator: "OR",
                  filters: local!AMUFilters
                )),
                 local!RoleLogicalExpression: if(
                rule!APN_isEmpty(
                  local!RoleSearch_txt
                ),
                null(),
                a!queryLogicalExpression(
                  operator: "OR",
                  filters: local!ROLEFilters
                )
              ),
             local!query: rule!GLOB_QueryNestedFilters(
                pagingInfo: local!pagingInfo,
                textParams_txt: {
                 
                  local!AMUSearchArray_txt,
                 
                  local!RoleSearch_txt
                },
                queryColumns_txt: {
                  cons!RTRR_HOG_QUERY_COLUMNS_BUSINESS_USER
                },
                textOperations_txt: {
                  "includes",
                 
                  "="
                },
                textColumns_txt: {
                  "AMUName",
                  "UserRole"
                },
                 QueryLogicalExpressions: filter(
                  rule!GLOB_isValueNotNull,
                  append(
                    {},
                    
                    local!AMULogicalExpression,
                    local!RoleLogicalExpression
                   
                  )
                )
                
              
                
                
                
              ),*/
              
             local!HOGUserList : rule!GetHogBuinessUsersByAMUAndRole(local!AMUSearchArray_txt,local!RoleSearch_txt),
           /* local!HOGUserList: a!queryEntity(
                
                entity: cons!RTRR_ENTITY_HOG_GIS_BUSINESSUSER,
                query: local!query
                
              ),*/
                if(local!showgrid,
            a!sectionLayout(
               label: "Search Results",
          firstColumnContents: {
             a!gridField(
               label:"",
                      totalCount: length(local!HOGUserList),
                      columns: {
          a!gridTextColumn(
                          label: "UserName",
                          field: "UserName",
                          data : index(local!HOGUserList,"UserName","")
                          
                        ),
                        a!gridTextColumn(
                          label: " EmailId",
                          field: "EmailId",
                           data : index(local!HOGUserList,"EmailId","")
                          
                        ),
                       
                        a!gridTextColumn(
                          label: "AMU",
                          field: "AMU",
                          data : index(local!HOGUserList,"AMUName","")
                          
                        ),
                        a!gridTextColumn(
                          label: "UserRole",
                          field: "UserRole",
                          data : index(local!HOGUserList,"UserRole","")
                          
                        )
                      },
                      value: local!pagingInfo,
                      saveInto: local!pagingInfo
                    ),
                   }
            ),{})
            
              
          )
        }
            },{}
        
        )
        }
      )
    )
)
            

Soujanya

  Discussion posts and replies are publicly visible

Parents
  • +1
    Certified Lead Developer
    What version of Appian are you using? I ask because you're still using the "<<" operator in your saveIntos and this is not necessary anymore and much more confusing than a!saveInto(), assuming you're using ANY of the more recent appian versions.

    Anyway, to clear the value of your dropdown field, which you're saving into the variable local!AMUArray_txt, you just need to set that value to null in your button click. I notice you're setting a few other things to null there, but you're not setting local!AMUArray_txt to null.

    All you need to add is:
    a!save(
    local!AMUArray_txt,
    null()
    )
Reply
  • +1
    Certified Lead Developer
    What version of Appian are you using? I ask because you're still using the "<<" operator in your saveIntos and this is not necessary anymore and much more confusing than a!saveInto(), assuming you're using ANY of the more recent appian versions.

    Anyway, to clear the value of your dropdown field, which you're saving into the variable local!AMUArray_txt, you just need to set that value to null in your button click. I notice you're setting a few other things to null there, but you're not setting local!AMUArray_txt to null.

    All you need to add is:
    a!save(
    local!AMUArray_txt,
    null()
    )
Children