3

I have a backbone collection model like this:

// The TaskCollection Model
app.models.TaskCollection = Force.SObjectCollection.extend({
model: app.models.Task,
fieldlist: ["Id", "Subject", "Status", "WhoId","AccountId","Description","WhatId", "Owner.Name", "Type","Priority","ActivityDate","OwnerId","CreatedById","CreatedBy.Name"],
cache: function() { return app.tasksCache;},
cacheForOriginals: function() { return app.cacheForOriginalTasks;},

getCriteria: function() {
    return this.key;
},

setCriteria: function(key) {
    this.key = key;
},

config: function() {
    // Offline: do a cache query
    if (!app.offlineTracker.get("isOnline")) {

        return {type:"cache", cacheQuery:{queryType:"smart", smartSql:"SELECT {tasks:_soup} FROM {tasks}", pageSize:300}};
    }
    // Online
    else {
            return {type:"soql", query:"SELECT " + this.fieldlist.join(",") + " FROM Task WHERE (WhatId != null or WhoId != null) and ActivityDate = LAST_N_DAYS:30 and  ActivityDate < NEXT_N_DAYS:15"};
    }
}
});

is there any way I can do a similar query as the SOQL one when I'm offline? I tried to do a smartsql query on ActivityDate but i got back only an error.

Any trivia/ideas/stroke of genius ?

M.

  • including the error might help. EDIT: Just realized how old this, hope you figured it out :) – Phil B May 15 '15 at 14:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.