Expression Error in Query Entity

Hi,

I am getting below pink error. The data is being fetched from a view and its an intermittent issue. Need your suggestion on this.

  Discussion posts and replies are publicly visible

  • if(rule!APN_isBlank(ri!studyId),{},a!queryEntity(
    entity: cons!SSU_DSE_VW_STUDY_QUESTION_READ_ONLY,
    query: a!query(
    selection: if(rule!APN_isBlank(ri!selection),{},
    a!querySelection(
    columns: a!forEach(
    items: ri!selection,
    expression:
    a!queryColumn(
    field: fv!item
    )
    )
    
    )),
    logicalExpression:
    a!queryLogicalExpression(
    operator: "AND",
    filters: {
    a!queryFilter(
    field: "studyId_Pk",
    operator: "=",
    value: ri!studyId
    ),
    a!queryFilter(
    field: "answerId_Pk",
    operator: "in",
    value: ri!answerId
    ),
    a!queryFilter(
    field: "questionId_Pk",
    operator: "in",
    value: ri!questionIds
    ),
    a!queryFilter(
    field: "keyCoreProcess",
    operator: "in",
    value: ri!keyCoreProcess
    ),
    a!queryFilter(
    field: "keyCoreProcessName",
    operator: "in",
    value: ri!keyCoreProcessName
    ),
    a!queryFilter(
    field: "answeredBy",
    operator: "in",
    value: ri!answeredBy
    ),
    a!queryFilter(
    field: "studyQuestionStatus",
    operator: "in",
    value: ri!studyQuestionStatus
    ),
    a!queryFilter(
    field: "questionlabel",
    operator: "includes",
    value: ri!questionLabel
    ),
    a!queryFilter(
    field: "status",
    operator: "in",
    value: ri!adminStatus
    ),
    a!queryFilter(
    field: "ansProviderRole",
    operator: "in",
    value:ri!ansProviderRole
    ),
    if(ri!needAttention=0,
    a!queryFilter(
    field: "needAttention",
    operator: "is null",
    ),
    a!queryFilter(
    field: "needAttention",
    operator: "=",
    value: ri!needAttention,
    )
    ),
    a!queryFilter(
    field: "isApplicable",
    operator: "=",
    value: 1,
    applyWhen: or(ri!studyQuestionStatus="Need Attention",ri!needAttention=1)
    ),
    a!queryFilter(
    field: "isActive",
    operator: "=",
    value: 1,
    applyWhen: or(ri!studyQuestionStatus="Need Attention",ri!needAttention=1)
    ),
    a!queryFilter(
    field: "questionIdentifier",
    operator:"in",
    value: ri!questionIdentifier
    ),
    a!queryFilter(
    field: "isApplicable",
    operator: "=",
    value: tointeger(ri!isApplicable)
    )
    
    },
    ignoreFiltersWithEmptyValues: true()
    ) ,
    pagingInfo:
    if(rule!APN_isBlank(ri!pagingInfo),
    a!pagingInfo(
    startIndex: 1,
    batchSize: -1,
    sort: a!sortInfo(
    field: "keyCoreProcessName",
    ascending: true()
    )
    ),ri!pagingInfo
    )
    ),
    fetchTotalCount: ri!fetchTotalCount
    ))

    This is the expression, and ri!selection is not being passed.

  • 1. For future reference please use the "Insert Code" option as it make sit easier to read the code and for folk to copy/paste it to their own Appian instance when trying to resolve the issues:

    2. if the issue is intermittent then the problem is probably with thee data and not the code. The message "An error occurred while retrieving the data" can be too much data (there is a limit on the amount of data that can be retrieved in one call) or bad data (e.g. a datetime field that contains an invalid datetime value such as '0000-00-00 00:00:00')

  • : Thanks for the suggestion on "insert code" that really helped.

    As you said, lets assume if the issue is because of bad data. Then will this cause the issue to be intermittent?

  • 0
    Certified Senior Developer
    in reply to Saahil Mulla

    i would recommend to check your cdt structure vs your table one.
    is studyId_PK of the same type in your cdt and in your DB? 
    example: like in your cdt its integer in your DB its something else?
    (perhaps nested before?)

  • An intermittent issue might be data related because it might depend on the context in which an individual data retrieval takes place. If you have no filters, that might result in fetching a large amount of data which may cause the issue. Or using certain filter values might retrieve a row from the database that has a bad data value. You should be able to find more details about the error in the logs.