[Solved]Enginio Qml - Getting Count



  • Could someone please tell me how to get the count of objects in enginio?

    @ var object = {
    "objectType": "objects.data",
    "result": "count"

            }
    
            var reply = client.query(object)
    
            reply.finished.connect(function () {
                if (reply.isError) { // Error
                    var errorType;
                    if (reply.ErrorType == reply.NoError) errorType = "The reply returned without errors"
                    else if (reply.ErrorType == reply.NetworkError) errorType = "The error was a networking problem"
                    else if (reply.ErrorType == reply.BackendError) errorType = "The backend did not accept the query"
    
    
                    messageBox.show("Save Failed.\n" + "Error Type : " + errorType + ".\nError Message : " + reply.errorString)
                } else { // Success
    
                    var data = reply.data.results
                    console.log(data.length) // returnds undefine
                    console.log(data.count) // returns undefined
    
    
                }
            })@


  • I found the solution. Its a bit hard to find the info especially to a beginner in cloud development as the documentation doesn't provide basic examples.

    @ var object = {
    "objectType": "objects.data",
    "count":true
    }

            var reply = client.query(object)
    
            reply.finished.connect(function () {
                if (reply.isError) { // Error
    
                    console.log("Error")
    
                } else { // Success
                    var data = reply.data.results
                    console.log(reply.data.count)
                }
            })@

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.