Determining the different options of a pull-down menu from a database entity?

Certified Associate Developer

I am trying to populate the values of a pull-down menu from a database. For this purpose, I defined cons!GENERIC_TASKS which points to corresponding database entity. I also have the following expression rule which reads all necessary data from the respective entity:

a!queryEntity(
  entity: cons!GENERIC_TASKS,
  query: a!query(
    selection: a!querySelection(
      columns: {
        a!queryColumn(
          field: "genericTaskName"
        )
      }
    ),
    pagingInfo: a!pagingInfo(
      startIndex: 1,
      batchSize: -1
    )
  ),
  fetchTotalCount: false
)

The test result of this rule looks promising since it contains all required data, the labels and the values.

In my user interface, I am now trying the following:

    a!dropdownField(
      label: "Generic step type",
      labelPosition: "ABOVE",
      placeholder: "--- Please choose a step type ---",
      choiceLabels: {rule!APAS_GetAllGenericTaskNames.data.genericTaskName},
      choiceValues: {rule!APAS_GetAllGenericTaskNames.data.identifiers},
      saveInto: {},
      searchDisplay: "AUTO",
      validations: {}
    )

However, this gives me the following error:

Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!dropdownField: Invalid index: Cannot index property 'data' of type Text into type Rule or Function Reference

What do I do wrong?

  Discussion posts and replies are publicly visible

Parents
  • +1
    Certified Lead Developer

    Additionally, the way you're trying to refer to "identifiers" won't work.  "Identifiers" is not a sub-property of ".data", but instead a property of the query result (i.e. the data subset returned by a!queryEntity).

    I suggest that instead of trying to mess with "identifiers", just include the primary key field in the list of columns you're including in your a!querySelection(); then you can refer directly to the primary key field by its field name instead of trying to use ".identifiers".

Reply
  • +1
    Certified Lead Developer

    Additionally, the way you're trying to refer to "identifiers" won't work.  "Identifiers" is not a sub-property of ".data", but instead a property of the query result (i.e. the data subset returned by a!queryEntity).

    I suggest that instead of trying to mess with "identifiers", just include the primary key field in the list of columns you're including in your a!querySelection(); then you can refer directly to the primary key field by its field name instead of trying to use ".identifiers".

Children