0

I am working on a mobile application using apache cordova.. I have a javascript file that reads data from an azure mobile service and persists it onto the local SQLITE database..

i have a function that is meant to query the azure mobile service but it gives me an error -"cannot read propert 'take' of undefinedType". The function is as follows

function refreshQuestionsTable() {
        alert("questions refreshing");
     var query = QuestionsTable.take(100).read().done(function (results) {
        alert(results.length); //see how many records were returned
        for (var i = 0; i < results.length; i++) {

    alert(results[i].question); //display the question returned
    commitQuestions(results[i].question_id, results[i].client_ref, results[i].question_set, results[i].question_dept, results[i].question, results[i].question_branch, null);

        }

    },function (err) {
        alert("Error: " + err);
    });  

} 
3
  • Where is the variable QuestionsTable defined? Commented Oct 12, 2015 at 21:40
  • Agreed here - there isn't enough information in the question to determine where you are going wrong, but I suspect it's in the definition of QuestionsTable. Check out the Azure Mobile Service Cordova SDK: github.com/azure/azure-mobile-services-cordova Commented Oct 15, 2015 at 17:24
  • the defination of questionsTable is as follows var MobileServiceClient = WindowsAzure.MobileServiceClient; var client = new MobileServiceClient('feedbackmaster.azure-mobile.net', 'oLMEOExWGFolBhpyYpTFkqvKuLNlyL91'); var QuestionsTable = client.getTable('client_questions'); Commented Oct 19, 2015 at 14:29

1 Answer 1

1

It looks like your client instantiation piece is wrong.

var client = new MobileServiceClient('feedbackmaster.azure-mobile.net/', 'oLMEOExWGFolBhpyYpTFkqvKuLNlyL91');

You had a ';' at the end of your URL for some reason. You should also do a .where() clause that is universally true. Take should work off of that.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.