Skip to main content
Known Participant
Mar 30, 2022 10:40 PM UTC
Question

Interface display error.

Hi,

Seeing the following error:

Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error in rule 'adv_getaddresses' at function 'type!{urn:com:appian:types:ADV}ADV_Address' (invalid) [line 23]: Invalid function 'type!{urn:com:appian:types:ADV}ADV_Address' due to invalid type

a!localVariables(
  local!locationsList: rule!ADV_getAddresses(addressId:NULL),
{
  a!sectionLayout(
    label: "Address",
    contents: {
      a!radioButtonField(
        label: "Radio Buttons",
        labelPosition: "COLLAPSED",
        choiceLabels:
            a!forEach(
              items: local!locationsList,
              expression: fv!item.shippingAddress  & " " & 
              if(isnull(fv!item.unitNumber), null,"Unit#"& fv!item.unitNumber)
              & " " & fv!item.city & " , " & fv!item.stateOrProvince
              & " " & fv!item.postalCode
             ),
        choiceValues: local!locationsList,
        saveInto: {},
        choiceLayout: "STACKED",
        validations: {}
      )
    }
  )
}
)

It calls an Expression Rule, which is as following:

a!localVariables(
  local!queryResults: a!queryEntity_18r3(
    entity: cons!ADV_DSE_ADDRESS,
    query: a!query(
      paginginfo: a!pagingInfo(1, - 1),
      logicalExpression: a!queryLogicalExpression(
        operator: "AND",
        ignoreFiltersWithEmptyValues: true,
        filters: {
          a!queryFilter(
            field: "addressId",
            operator: "in",
            value: ri!addressId
          ),
          
        }
      )
    )
  ).data,
  cast(
    typeof(
      {
        'type!{urn:com:appian:types:ADV}ADV_Address'()
      }
    ),
    local!queryResults
  )
)

What could be the issue in the code?  Pls kindly help!!

Thanks,
Suneetha.

    11 replies

    mathieud0001
    Genius
    Mar 30, 2022 11:29 PM UTC

    Says that you have an invalid type.

    Are you sure that the ADV_Address type exists? Perhaps the namespace could be the issue?

    'type!{urn:com:appian:types:ADV}ADV_Address'()

    Known Participant
    Mar 31, 2022 2:53 PM UTC

    Yes, ADV_Address type exists..

     

    stefanhelzle0001
    Brainy
    Mar 31, 2022 2:56 PM UTC

    The names are case sensitive. This is ADV_address vs. ADV_Address.

    gopalk2865
    Participating Frequently
    Mar 31, 2022 7:01 AM UTC

    Hi suneethag0001, Please make sure you are casting your data into a valid cdt. Check your query output data and cast them in a matching data type. I hope it helps.

    mikes0011
    Brainy
    Mar 31, 2022 3:47 PM UTC

    Secondary to what the others here have said - the rule doesn't need to use the typeof( {type!...} ) in the CAST() function.  This works but there's a much cleaner way of doing the same code.

    Insetead you can just use the type! directly - by removing the parentheses from the end and adding "?list" -- like the following:

    cast(
      'type!{urn:com:appian:types:ADV}ADV_Address?list',
      local!queryResult
    )

    The Expression Guru