This is a migrated thread and some comments may be shown as answers.

data.aggregate(query) error

2 Answers 18 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ignacio
Top achievements
Rank 1
Ignacio asked on 23 Jan 2017, 08:37 PM

Hi there,

My function nFac() don't works because I have changed the permissions of the table servicios to Private, returning this error:

{"message":"READ access on type 'servicios' denied for anonymous user.","code":603}

Thanks.
My code:

---------------------------------------------------------

function nFac() {
 
    var el = new Everlive('7y...lk');
    var data = el.data('servicios');
    var query = new Everlive.AggregateQuery();
 
    query.sum('registro', 'fra'); 
    
    return data.aggregate(query)
        .then(function(data) {
                var s = JSON.stringify(data);
                var j = JSON.parse(s);
                return j.result[0].fra;
            },
            function(error) {
                alert(JSON.stringify(error));
            });
}

2 Answers, 1 is accepted

Sort by
0
Accepted
Preslav
Telerik team
answered on 26 Jan 2017, 07:59 AM
Hello Ignacio,

Generally speaking, you should have only one instance of Everlive in an app.

This faulty behavior happens because the server cannot find any logged in users in the instance created in the nFac function. In order to fix this, you will need to aggregate the data for the  table from the same instance of the Everlive where the user is logged in. In other words, do not create a new instance of Everlive in the nFac function and use the one with the user.

Additionally, I'd suggest checking our Data and Authentication Hybrid tutorial. In this tutorial, you will create an app with a private list of groceries for the registered users.

Regards,
Preslav
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Ignacio
Top achievements
Rank 1
answered on 27 Jan 2017, 01:09 PM
Thank you !
Tags
General Discussions
Asked by
Ignacio
Top achievements
Rank 1
Answers by
Preslav
Telerik team
Ignacio
Top achievements
Rank 1
Share this question
or