Sorting Info throws an error when the data returned from the QE is null

I am trying to apply sorting on the primary key, while getting data is batches its breaking when the data returned from the query entity rule is null.

If sorting based on any other fields its working fine, with or without data

Code used: 

a!pagingInfo(
startIndex: 1,
batchSize: 5,
sort: a!sortInfo(
field: "agendaItemIdPk",
ascending: true()
)
)

If we get the data we batch size -1 its working fine. Has anyone faced this issue if yes then whats the way around?

  Discussion posts and replies are publicly visible

  • 0
    Certified Senior Developer

    It will be good if you can share your queryentity code .

  • 0
    Certified Lead Developer

    Are you saying it works with the exact same code if you change "5" to "-1" to return all rows?  Or is there another change involved?

    If you're querying against a very inefficiently defined View, I suppose you could be running into an issue with QueryEntity/'s fetching of TotalCount.  If you don't have "fetchTotalCount" manually defined, it'll behave differently (iirc) between passing "-1" for batchSize and passing an actual batch size (i.e. 5).  I could imagine a scenario where just the attempt to fetch the total count causes the query to time out - and for the error message you posted, the query timing out is the most common underlying cause i've seen (though you should check your Tomcat-STDOUT.log file for more detail, it'll probably tell you exactly what the query issue was).

  • The view is not timing out, did check that.

    ex. in the below example if I pass the batch size as 5 for the user its erroring out

    while for the same user if I am passing the batch size as -1 its not, a datasubset with null data is provided as output

  • 0
    A Score Level 1
    in reply to namitakyal

    As per my analysis, the combination of

    batchSize <> -1 and the sorting on primary key is errored out

  • 0
    Certified Lead Developer
    in reply to namitakyal

    What does your tomcat-stdout.log file say?

  • Its the same
    [ajp-nio-0.0.0.0-8009-exec-12] ERROR com.appiancorp.rest.shared.AppianExceptionMapper - Internal Server Error on REST API invocation.
    com.appiancorp.exceptions.LocalizedAppianRuntimeException$LocalizedAppianException: Expression evaluation error [evaluation ID = 5156f:e488b] in rule 'dg_qe_getagendaitemdetailsforlandingpage' (called by rules 'dg_s_myagendaitemforlandingpagedetailedview' > 'dg_ui_landingpagesections' > 'dg_ui_overalllandingpage') at function a!queryEntity: An error occurred while retrieving the data. Details: Unexpected error executing query (type: [DGVAgendaItemDetailsLandingPageDT4766], query: [queryentity expression], order by: [[Sort[agendaItemIdPk asc]]]

  • 0
    Certified Lead Developer
    in reply to namitakyal

    If possible, try hunting down through the further related error log entries (they'd all be under approximately the same timestamp).  I know a lot of it is gibberish, but there's a possibility that one of them will expose the specific reason the query failed.

  • I could only find this nothing else, and this provide no details, if it does to you please let me know

    Caused by: com.appiancorp.suiteapi.common.exceptions.AppianRuntimeException: com.appiancorp.suiteapi.common.exceptions.AppianException: An error occurred while retrieving the data. Details: Unexpected error executing query (type: [DGVAgendaItemDetailsLandingPageDT4766], query: [queryentity expression], order by: [[Sort[agendaItemIdPk asc]]]
    at com.appiancorp.expr.server.fn.query.DefaultQueryExceptionTranslator.apply(DefaultQueryExceptionTranslator.java:22)
    at com.appiancorp.expr.server.fn.query.QueryEntity.queryDataStoreEntity(QueryEntity.java:235)
    at com.appiancorp.expr.server.fn.query.QueryEntity.queryentity_appian_internal(QueryEntity.java:162)
    at com.appiancorp.expr.server.fn.query.QueryEntity.executeQuery(QueryEntity.java:106)
    at com.appiancorp.expr.server.fn.query.QueryEntity.executeQuery(QueryEntity.java:79)
    at com.appiancorp.expr.server.fn.query.AbstractQueryExecutor.op(AbstractQueryExecutor.java:66)
    at com.appiancorp.core.expr.fn.Signature.eval(Signature.java:181)
    at com.appiancorp.core.expr.fn.Function.eval0(Function.java:62)
    at com.appiancorp.core.expr.DefaultEvaluable.eval(DefaultEvaluable.java:207)
    at com.appiancorp.core.expr.FunctionCallDelegate$InternalFunctionCallWithContext.eval(FunctionCallDelegate.java:282)
    at com.appiancorp.core.expr.FunctionCallDelegate.evalCacheableFunctionCall(FunctionCallDelegate.java:138)
    at com.appiancorp.core.expr.FunctionCallDelegate.evalFunctionCall(FunctionCallDelegate.java:103)
    at com.appiancorp.core.expr.AppianScriptContextTop.evalInternalFunction(AppianScriptContextTop.java:524)
    at com.appiancorp.core.expr.AppianScriptContextChild.evalInternalFunction(AppianScriptContextChild.java:293)
    at com.appiancorp.core.expr.tree.FunctionCall.evalImmediate(FunctionCall.java:577)
    at com.appiancorp.core.expr.tree.FunctionCall.evalEvaluable(FunctionCall.java:527)

  • 0
    Certified Lead Developer
    in reply to namitakyal

    Can you try to replicate this with another table? It might be that there is a tiny mismatch between the CDT/XSD and the table or view definition.