I am working on a javascript hybrid App. I have a soup declared with along with the model collection:
// The Collection Model
app.models.SerieCollection = Force.SObjectCollection.extend({
model: app.models.Serie,
fieldlist : ["Id", "some_field__c"],
cache: function() { return app.seriesCache;},
....
And the soup
app.seriesCache = new Force.StoreCache("series", [{path:"Id", type:"string"}]);
Later on in the app I want use SmartQuery to get all the entries which have some_other_field__c = 'some text'
var querySpec = navigator.smartstore.buildSmartQuerySpec("select {series:some_field__c} from {series} where {series:some_other_field__c}='some text', 1);
navigator.smartstore.runSmartQuery(querySpec, function(cursor) {
console.log(cursor.currentPageOrderedEntries[0]);
});
I've tried also the following:
var queryString = "select {series:Link_Serie_su_sito_web__c} from {series} where {series:Name}='"+key+"'";
app.seriesCache.find({queryType:"smart", smartSql:queryString, order:"ascending", pageSize:1}).then(function(result){
console.log("SMART SQL: "+result.records[0]["Link_Serie_su_sito_web__c"]);
});
But when I run it in the emulator with the first trial I get:
E/Web Console(2263): com.salesforce.smartstore:pgRunSmartQuery failed at file:///android_asset/www/extlib/cordova.force.js:190
and in the console log I read "undefined"
With the second trial I get nothing on the console (not even an error)
The documentation is quite puzzling about this, have I to declare in the indexes of the soup also some_field__c? Even if I want to use SmartQuery?
Thanks for the assistance, T.