Skip to main content
priyankav4295
September 8, 2022
Question

can only be indexed into using square brackets or the index function

  • September 8, 2022
  • 4 replies
  • 2 views

Hi All, 

I am getting the below error ,

Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!dropdownField [line 143]: Example can only be indexed into using square brackets or the index function

I tried to pass the values of the  record type query list values to a  local variable and when trying to pull using dot notation or index function in a!dropdown component  ,

a!localVariables(
local!List: a!queryRecordType(
recordType: 'recordType!Example',
filters: {
a!queryFilter(
field: 'recordType!Example.fields.Flag',
operator: "=",
value: true),
a!queryFilter(
field: 'recordType!Example.fields.Date',
operator: ">=",
value: ri!StartDate,
applywhen: (if(isnull(ri!StartDate), false, true))
),
a!queryFilter(
field:'recordType!Example.fields.Date',
operator: "<=",
value: ri!EndDate,
applywhen: (if(isnull(ri!EndDate), false, true))
)
},
fields: 'BU',
pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 500)
).data,
a!dropdownField(
label: " Unit",
labelPosition: "ABOVE",
placeholder: "--- Select a Value ---",
choiceLabels: local!List.BU,
choiceValues: local!List.BU,
value: ri!BusinessUnit,

searchDisplay: "AUTO",
validations: {}
)
)

I read this  post  https://docs.appian.com/suite/help/21.4/reference-records.html#referencing-record-fields-and-field-values , but still no luck . Any pointers or suggestions will be helpful.

Thanks,

Priyanka

    4 replies

    stefanhelzle0001
    Brainy
    September 8, 2022

    As in the documentation, change

    local!List.BU

    to

    local!List[RecordType!Example.fields.BU]

    September 8, 2022

    I see multiple issues here: 

    Single inverted comma(') should not be here on top of recordtype.

    'recordType!Example.fields.Flag'

    Field should be under recordtype. Example recordType!Example.field.BU

    fields: 'BU',

    Under dropdown, use [recordType!Example.field.BU] for choice labels & values.

    local!List.BU

    For more:- Appian Records - Appian 22.3

    mikes0011
    Brainy
    September 8, 2022
    Single inverted comma(') should not be here on top of recordtype.

    AFAIK this is how the 'recordType!' namespace objects evaluate when copied-and-pasted out to plaintext.

    The Expression Guru
    September 8, 2022

    Oh Okay, Thanks for the correction.