What if I don't want to use online database?

I have created the 'shell' or UI of my application.

I have NOT added any db services as of yet.

I want it to work exclusively offline and self contained to the mobile device it gets installed on.

Can I just create and map to Generic Rest Services to make that happen?

Do I need a Generic Rest Service for each; Create, List, Delete?

If so, I do not have a URL to put in place and not sure what to direct it to.
2 people have
this question
+1
This topic is no longer open for comments or replies.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned sad, anxious, confused, frustrated

  • I’m frustrated
    Currently, when I turn off wifi to my mobile device, I can see data from local storage on my UI list from one table only. But, my database has two tables.
    Also, I can neither add nor delete (on the ONE table) from the UI unless I reconnect to the internet.
    I think I can configure the other table to show via local storage. I do not know if I can make them ADD data from the UI form, or DELETE from the UI. Both of those functions work if I am online. Is it a permissions issue or is my local storage somehow set to read only?
    Let me know if you can assist and I will share the app with you.
    • view 2 more comments
    • Hello Dave,

      I was not able pass step #5. Entry is not added.
      Did you change anything?
    • Step 5 takes you to the Doctors list. I just added a doctor named 'test' to the list and it saved just fine. The middle button with '+ Doctor' is to add Doctors to the list. Sorry if I was not clear.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned sad, anxious, confused, frustrated

  • This topic is not completed.. please reopen. App does accept new doctors added. Please try again. Then complete offline to see what is actually not working.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned sad, anxious, confused, frustrated

  • Hi Dave,

    You need to use developer tools for debugging your application: http://devcenter.appery.io/documentat...
    Your application contains some errors:

    Let's fix them and then go ahead.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned sad, anxious, confused, frustrated

  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned sad, anxious, confused, frustrated

  • The syntax error with the return was a simple fix. I removed the return and that one cleared.

    I don't know how to fix the value errors. I haven't a clue what it is asking or what I am looking for. All the research I did in Google on the error was totally over my head.

    Can you please help me fix these? App is still shared with Support.



    Strangely when I add the third '=' to line 27, it fixes that lines error, but then generates the error at line 28 your are seeing in the illustration above.

    27. if (results.rows.length == 0)
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned sad, anxious, confused, frustrated

  • Hello Dave,

    Uncaught SyntaxError: Illegal return statement
    occurs because you use in your code MedDB_LocRestJS.js return out of function. Remove this line (the last one in this file).

    Uncaught ReferenceError: value is not defined
    and this error occurs because you use undeclared variable value. You must first assign it a value, and only then use
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned sad, anxious, confused, frustrated

  • Hi Dave,

    In MedDB_LocRestJS you use a variable 'value' (in SQL requests). At the moment it is empty (not declared). You should initialize it first.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned sad, anxious, confused, frustrated

  • Just to clarify... the script I am trying to adapt is from Appery.io example at: http://devcenter.appery.io/tutorials/...

    It contains all three errors I am experiencing BEFORE I modified the code. Why would Appery.io provide faulty code for an example of how to do something?

    Seven lines down you will find value._id ... where is it defined in this script?

    Ten lines down you will find (results.rows.length == 0) and should be (results.rows.length ===0) instead.

    At the very bottom you have the return; which throws a syntax error.

    Now I may not know or understand javascript, but I do know that I cannot learn from examples that are already broken.

    My app is still shared with Support. Someone PLEASE help me fix this script in my app.

    var db = window.openDatabase("Wedding 0.1", "", "Wedding 0.1", 1024*1000);

    db.transaction(function (tx) {
    tx.executeSql('CREATE TABLE IF NOT EXISTS "Tables"(_objectId TEXT, number TEXT, left TEXT, top TEXT, visible TEXT, _createdAt DATETIME, _updatedAt DATETIME)', []);
    tx.executeSql('SELECT * FROM "Tables" WHERE "_objectId" = "' + value._id + '"', [], function(tx, results){
    console.log('rows :' + results.rows.length);
    if (results.rows.length == 0){
    console.log('Go and add table ' + value.number);
    tx.executeSql('INSERT INTO "Tables" (_objectId, number, left, top, visible, _createdAt, _updatedAt) values (?, ?, ?, ?, ?, ?, ?)', [value._id, value.number, value.left, value.top, value.visible, value._createdAt, value._updatedAt]);
    }
    });
    });

    return;
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned sad, anxious, confused, frustrated

  • Hi Dave,

    Before using any variables you should define them. Variable "value" is undefined in your script "MedDB_LocRestJS.js" that is why you get errors. You should define it before using and set values for it. For example write values to it from database response.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned sad, anxious, confused, frustrated

  • Again Katya, all of your team is talking over my head.

    Please show me an example of what I can do with the line that is broken.

    tx.executeSql('SELECT * FROM "Tables" WHERE "_objectId" = "' + value._id + '"', [], function(tx, results){
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned sad, anxious, confused, frustrated

  • Hello Dave,

    You can create value object:

    var value = {_id:1,
    number:1,
    RxName: "name",
    Dose : 1,
    Freq_Num : 1,
    Freq_Per : 1,
    RxNum : 1,
    Pharmacy : "sss",
    PharmNum: 1,
    Notes : "sss",
    StoreNum: 1,
    _createdAt : "01.01.2014",
    _updatedAt : "01.01.2014"
    } ;


    and delete return in file "MedDB_LocRestJS.js"
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned sad, anxious, confused, frustrated

  • Hi Evgene,
    I inserted the above and am getting some unexpected extra lines in local storage.. Please help me.



    My script is now as follows:

    Appery.MedDB_LocRestJS = Appery.createClass(null, {

    init : function(requestOptions) {
    this.__requestOptions = $.extend({}, requestOptions);
    },

    process : function(settings) {
    this.settings = settings;
    settings.beforeSend(settings);
    if (this.__requestOptions.echo) {
    settings.success(this.__requestOptions.echo);
    } else {
    console.log('Default implementation is used. Please define your own.');
    settings.success({});
    }
    settings.complete('success');
    }

    });

    var db = window.openDatabase("Meds_DB", "", "Meds_DB", 1024*1000);

    var value = {_id:1,
    number:1,
    RxName: "name",
    Dose : 1,
    Freq_Num : 1,
    Freq_Per : 1,
    RxNum : 1,
    Pharmacy : "sss",
    PharmNum: 1,
    Notes : "sss",
    StoreNum: 1,
    _createdAt : "01.01.2014",
    _updatedAt : "01.01.2014"
    } ;

    db.transaction(function (tx) {
    tx.executeSql('CREATE TABLE IF NOT EXISTS "MedsColl"(_objectId TEXT, RxName TEXT, Dose TEXT, Freq_Num TEXT, Freq_Per TEXT, RxNum TEXT, Pharmacy TEXT, PharmNum TEXT, Notes TEXT, StoreNum TEXT, _createdAt DATETIME, _updatedAt DATETIME)', []);
    tx.executeSql('SELECT * FROM "MedsColl" WHERE "_objectId" = "' + value._id + '"', [], function(tx, results){
    tx.executeSql('INSERT INTO "MedsColl" (_objectId, RxName, Dose, Freq_Num, Freq_Per, RxNum, Pharmacy, PharmNum, Notes, StoreNum, _createdAt, _updatedAt) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', [value._id, value.RxName, value.Dose, value.Freq_Num, value.Freq_Per, value.RxNum, value.Pharmacy, value.PharmNum, value.Notes, value.StoreNum, value._createdAt, value._updatedAt]);
    }
    );
    });
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned sad, anxious, confused, frustrated

  • Hello Dave!

    I am sorry to have to tell you, but building app with offline DB fails outside the scope of our support. We have posted a lot of suggestions, but building app, reviewing/debugging custom app code/scripts are outside the scope of support.
    You can contact Appery.io services team http://appery.io/services/ so they can take a closer look at your problem.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned sad, anxious, confused, frustrated