Google Indexed DB and Compatible Controls

Two questions:

  1. I created my indexeddb and it works fine as long as I have app studio open. When I close
    app studio, all of the data in the database is removed. How do I keep the data stored permanently?

  2. I am using common and bootstrap4 controls. Are these compatible?

  1. How are running your app?

  2. Yes, the Common controls work with everything.

I am using the same procedure as I was using under the previous version of App Studio -
F6 Deploy. Thank you for your assistance…Joel Buschek

Have you considered using PouchDB instead? It will leverage the underlying browser IndexedDB and will also allow you to replicate the DB contents to a CouchDB instance. You can use this feature to have your app replicate its data to a central server and if the users deletes it and reinstall, the app will heal itself and replicate the data back into the device. It will also keep the data in sync if the users run the app in multiple devices.

F6 Deploy send the project to your default Deploy method. What is it?

In my preferences, deployment is to my local path. I looked into the deployment references in the handbook and they refer to a “picker” in the deployment bar. I am not receiving this picker option or the deployment bar when I open a new project.

I believe selecting “nsbasic server” should be an option that I am not seeing for a new project. Is there a way of activating the deployment bar in a new project or activating the picker option for an existing project? I can fill in the “nsbasic server” in preferences, but I do not have a password for the server. Would this work? Thanks for your help…Joel

Thanks for the suggestion Ricardo. I will research this option…Joel

@Joel, what version of AppStudio are you using?

Version 8.1.0.3. No Updates Needed I found the ToolBar under View,
but I am not sure what URL to use.

Thanks for your help…Joel

Good, so you’re up to date.

This is the picker I am referring to:

Thank you. I have the picker with the two deploy options. Not sure about
where to refer to “About.”

Have a look at the image I just posted. Do you see something like that on your AppStudio? What’s in it?

The About screen is an option on the Help menu (if you’re on Windows). All apps have them.

image Looks like the image.
Renewal is 2021-05-31. Joel

Back to the original question.

Try deploying to Volt instead. Then the project has a more permanent home.

I selected Deploy to Volt in the picker and got the following dialog:

image

Which option should I use? Thanks Joel

While waiting, I decided to try deploying to Volt and selected the demo account first. I got the following message:

image

I clicked on the first link “Your app” and my app appeared without the Google debugger or some form of Volt dashboard? I loaded the database and the app appeared to operate OK. However, when I left the studio, and came back - same result - the database had lost its data.

I then clicked on the second link and I got the following Create Account Message:

I attempted to create an account, be an error message appeared that my email account
was in use. Not sure where to go from here? Joel

IndexedDB: Better share your code. Maybe there is something in it which wipes it out.

Volt Sign On: Try to sign on as an existing user, then click on the Forgot Password option to reset your password.

Volt sign on: I tried signing in as an existing user, and got the following email:
However, there was no link to click? Tried several times and got the same
result

Email from Volt:
Click the link below to reset your password: (No link included)

I will send you a copy of my generic indexeddb code shortly…Joel

The following generic code is used to create the indexeddb, and open the existing db. The procedures work when I launch the Desktop Browser, and the database is shown in the Google databases with the data included. The data is lost when I close App Studio, and then restart it.

Below is generic code showing the code structures. My real code is quite lengthy so I thought we could start simple and work up. In the meantime, I will continue to research the Google references for indexed db. I noticed that their “PWA” is currently being updated. Could these changes be effecting my work?

//THIS FUNCTION CREATES THE INDEXEDDB
function DBI10openDB() {
  var DBNAME = "name_db"; //1st backup database
  var DBVER = 2
  var request = indexedDB.open(DBNAME,DBVER);
      request.onupgradeneeded = function(e);
     UTL0LogIt("Upgrading...");

        var thisDB = e.target.result;

        var store = null;

        if (!thisDB.objectStoreNames.contains(“object1_name”)) { 
            //bucket for object1_name information 
            // create objectStore object1_name as keyPath=kpid
            var objectStore=thisDB.createObjectStore("object1_name", {keyPath: "kpid"});
            objectStore.createIndex('pid', 'pid', {unique: false});
            objectStore.createIndex('ps', 'ps', {unique: false});
            }

        if (!thisDB.objectStoreNames.contains('object2_name')) { 
            //bucket for object2_name information
            // create objectStore object2_name as keyPath=kbyid
            var objectStore=thisDB.createObjectStore("object2_name", {keyPath: "kbyid"});
            objectStore.createIndex('ey', 'ey', {unique: false});
            objectStore.createIndex('cy', 'cy', {unique: false});
            objectStore.createIndex('sd', 'sd', {unique: false});
            objectStore.createIndex('ed', 'ed', {unique:false});
            objectStore.createIndex('dr', 'dr', {unique: false});
            } 
       …several more object stores then  
    };
    request.onsuccess = function(e) {
        UTL0LogIt("DBI10openDB success!");
        name_db = e.target.result;
        UTL0LogIt("this is the db:  " + name_db);
   };
   request.onerror = function(e) {
      UTL0LogIt("Database error: " + e.target.errorCode);
   };
}

//THIS FUNCTION OPENS THE EXISTING DB

function DBI11openExistingDB() {
  var request = indexedDB.open("name_db", 2);
    
    request.onsuccess = function(e) {
       name_db = e.target.result;
       UTL0LogIt("DBI11openExistingnDB success! ");
       UTL0LogIt("this is the name_db:  " + name_db);
       
   };
   request.onerror = function(event) {
      UTL0LogIt("Database error: " + e.target.errorCode);
   };
}

Hope this helps.

Using “Start in Desktop Browser”, I noticed when I deploy, the URL = 127.0.0.1:#####/Project Name/.

As long as I remain in AppStudio the URL does not change. However, if I close AppStudio then reopen AppStudio and deploy again, the ##### part of the URL changes, and the indexeddb is empty of data. Since the page URL has changed so has the page, and it makes sense that the new page would not contain the database information.

When I type in the URL of the previous page, the browser message is that “the web page may be
temporarily down or has moved.”

Once I deploy, is there a way of saving the original URL page?? Thanks…Joel

PS My indexeddb code operated without error for over a year on the previous version of App Studio.