[SOLVED] Data from Enginio Reply



  • Hello all!

    I need to get tha data returned from an EnginioClient

    How can I do that?

    Here is the code:

    EnginioClient {
            id: clienteEnginio
            backendId: "55944b4dd45dfe1db9022872"
        }
    
    Component.onCompleted: {
            var query = {
                "objectType" : "objects.pais",
                "sort": [{"sortBy": "nome", "direction": "asc"}]
            };
    
            var buscaPaises = clienteEnginio.query(query);
        }
    


  • The finished signal gives you the data in reply.data.results. Just do

    onFinished: console.log(JSON.stringify(reply))

    and you can see what the response looks like.



  • Hello Guilherme,

    I suggest to work with an EnginioModel like that:

    EnginioClient {
    	id: clienteEnginio
    	backendId: "myID"
    }
    
    Component.onCompleted: {
    	var myquery = {
    		"objectType" : "objects.pais",
    		"sort": [{"sortBy": "nome", "direction": "asc"}]
    	};
    }
    
    
    EnginioModel {
    	id: modelEnginio
    	client: clienteEnginio
    	query: myquery
    }
    // Data from your Enginio object:
    Text {
    	id: txNome
    	text: nome
    }
    


  • @xargs1 Thanks for the reply

    @clochydd I was doing this with EnginioModel, but I need to filter the results without quering new results every time. There is a way to do that?



  • You may put the results into another model or use it like this:

    var reply = clienteEnginio.query(myquery)
    reply.finished.connect(function() {
    	var results = reply.data.results
    	console.log("1st entry: ", results[0].nome, results[0].f2, results[0].f3)
    	console.log("2nd entry: ", results[1].nome, results[1].f2, results[1].f3)
    })
    


  • @clochydd Thanks. It worked.


Log in to reply
 

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