Skip to main content
Participating Frequently
Aug 11, 2022 3:28 AM UTC
Solved

pickerFieldCustom display value

a!localVariables(
  local!customerName,
 
  a!pickerFieldCustom(
    
    label: "Enter Customer Name, 
    placeholder: "Type to select the employee's state of residence",
    maxSelections: 1,
    suggestFunction: rule!CP_AAACUSTOMER(
      filter :_ ,
    
    ),
    
    selectedLabels: local!customerName,     
   
    value: local!customerName,

    saveInto: {local!customerName}

  )
)


a!localVariables(
  local!matches: (
    a!queryEntity(
      entity: cons!CP_AAA_CUSTOMER,
      query: a!query(
        logicalExpression: a!queryLogicalExpression(
          operator: "AND",
          filters: {
            a!queryFilter(
              field: "name",
              operator: "includes",
              value: ri!filter
            )
          },
          ignoreFiltersWithEmptyValues: true
        ),
        pagingInfo: a!pagingInfo(
          startIndex: 1,
          batchSize: 50
        )
      ),
      fetchTotalCount: false
    )
  ),


  a!dataSubset(
    data: local!matches.data,
    identifiers: index( local!matches, "identifiers",{})
  )
  
)

Please find above screenshots (Expression Rule and output + SAIL code and Interface .  I'm using pickerfieldCustom here. Please help me to display  "name' only  and how to display and save  selected name .  Currently it displays and save ' id ' . Please let me know if i need to make any changes in  Interface or/and Exp Rule ?

stefanhelzle0001
Brainy
Aug 11, 2022 6:35 AM UTC

a!dataSubset(
    data: index(local!matches.data, "name", {}),
    identifiers: index( local!matches, "identifiers",{})
  )

This is very simple. The data attribute is what you see and the identifiers is the stored value. And, you can put anything you like into identifiers.

6 replies

Inspiring
Aug 11, 2022 4:55 AM UTC

user index({your rule},"name",{}) into your suggested function code.

Participating Frequently
Aug 11, 2022 6:20 AM UTC

Iindex(rule!CP_AAACUSTOMER(filter :_ ),"name",{}),  and it throws below error The function 'suggestfunction' is unavailable.

stefanhelzle0001
Brainy
Aug 11, 2022 6:19 AM UTC

As the documentation describes, the data attribute of the returned datasubset of your suggest function must be a list of strings which will then populate the dropdown.

Participating Frequently
Aug 11, 2022 6:23 AM UTC

It is populating the data  id and name.  Question is   1 )how to populate only name . 2) how to save name value  ?  right now it is saving id. 

stefanhelzle0001
Brainy
Aug 11, 2022 6:35 AM UTC

a!dataSubset(
    data: index(local!matches.data, "name", {}),
    identifiers: index( local!matches, "identifiers",{})
  )

This is very simple. The data attribute is what you see and the identifiers is the stored value. And, you can put anything you like into identifiers.