I am having problems getting a watcher to work, and I am trying to sequence some javascript to run in the right order.
Fire off watcher start....I get the "watcher start" alert first.
Run this JS code to create a SQlite database, create a table, and add a record.
Now set the watcher variable value to something...
I do not get any response from my watcher... None of this watcher code fires off
Not sure what is going on
Hello Ryan,
Maybe you no need the Watcher at all? That is, since "db.transaction" already provide the "success" and the "error" callback, that is what you must to use in order to do what you wanted. For example, if you wanted to perform some action after "db.transaction", you MUST wait for the "success" or the "error" callback, and therefore continue the work.
Similarly when you use an HttpClient control: after execute the HTTP call, we must wait for the events of the HttpClient control, in order to continue, for example, with other HTTP call.
What do you think about? There is a Watcher sample app that works as expected, so, maybe what happen is the Watcher is not the right solution for your specific case.
If I add this callback to the db.transaction, I dont get the alert or an error:
this version does not alert either:
The larger issue is that I have about 10 Http Get calls to make do load data into the Sqlite database for offline use. I need to chain those calls together so they run in order of 1:Many relationships. Each Http control is going to have a matching Sqlite insert function similar to the one in this post. So what I was envisioning was some like:
Hello Ryan,
Follow the plugin's documentation, something like below must work:
Means... one of the provided callback must be executed, except if what you wanted is to use a third callback... because, again, according this plugin's documentation, a third callback is supported:
What I can't see is any syntax error in your code: so, one of the provided callback must be executed... except if "db.transaction" can be called without cause to call any of the provided callbacks: you must look at the plugin's documentation or ask the author about: "is db.transaction" executing always at least one of the provided callbacks, or what?".
I understand what you wanted, however, the Watcher must work... except if the code cause other thing... but anyway, I did not consider a Watcher to do something like you wanted. If you need to made 10 or any other number of HTTP calls in certain order, just execute the calls in the right order. Every HttpClient control provide an "Error" and a "Success" event, which we can use in order to do what we need: abort possible next calls, continue with them, etc.
Maybe you can reduce the complexity and do not made such a number of HTTP calls in certain specific order... but,... if you see that you must perform that number of HTTP calls and in certain order... just do it... start with the first one and end with the last of them... using the HTTP Client control's events. On the other hand,... be sure that no one of the callbacks provided to "db.transaction" are not executed: maybe something is wrong, so, you must debug it.
P.S. Take a look at the Debugger help topic of the new AB: you can use it also for the previous AB. Look mainly at the Debug Apache Cordova apps: basically you must take a look at the console in order to see what happend, since, if any of the "db.transaction" provided callbacks are executed... maybe some error occur... and you must see what error is in order to fix it.
I followed the directions here ( https://www.getappbuilderhelp.com/help/en-US/apache-cordova.html#batchfiles-integration ) and the app gets launched to my attached Andoid, but the debug console in the AB does not fire up
Hello Ryan,
The debug console is shown in the console window, not in AB. The "Run" Batch file compile and launch the app in an attached device, and, after that the console window show the debug information. So we are not talking about the console in AB, but the console window itself.
If you can't see anything rare... you must start step by step. For example, forget any HTTP call, just perform a "db.transaction", and see what happen: in other words, see if everything is fine and what callback is executed: asuming one of them must be executed... I think so, however, can't see in the plugin's documentation the "params help" for "db.transaction".
using the Run bat is launching the app on my connected tablet but the console window (npm) does not show any console.log out put.
This time I got an error that 'adb' is not regocnized as an internal or external command, operable program, or batch file
Hello Ryan,
"adb" means Android Debug Bridge. It's a command line tool which come with the Android SDK. What happen is that the tools is not in your PATH environment variable. You must set the path for the "adb" tool (see the previous link for his location) into your PATH environment variable.
David, I got the ABD working. It is very helpful.
So, here is something interesting. I got this code to work when the first view event "Show" fires.
and here is the output of the console window...
However, after this JS code finishes, no other code will run. Even code I put into the success callback such as this...
...will not execute. I also quickly built this same code in the new AB 2020 with the same results.
Hello Ryan,
No errors at all? That is... my idea right now is that "tx" may is not defined... Apparently "tx" can be used inside the right "db.transaction" callback, but, outside that callback... where is "tx"? So maybe this is the problem, that "tx" is not defined?
There must be another way to execute queries on existing databases... without the "tx"... or you must use the "tx" inside a "db.transaction" callback... in which "tx" exists. I hope this can at least give you an idea about where to look.
All of the samples and documents for this plugin use "tx" or "transaction" inside of the db.transaction callback.
https://github.com/brodybits/cordova-sqlite-test-app
https://github.com/xpbrew/cordova-sqlite-storage#sample
I built this test app using AB 2020 as detailed in this link, and it also did not work. ( https://github.com/brodybits/cordova-sqlite-test-app/blob/master/www/app.js ). The only feedback I get from the console is that the database is waiting to close after I issued a close command. It seems like something is not getting released by the plugin.
Offline data is critical to this app... I have to get this or another offline solution working.
I deleted the Cache and Compiled folders just in case something is not compiling clean. Now the output in the console is this. I am not sure what this means.
Hello Ryan,
About the "tx" identifier, certainly, it appear as an argument of certain callback of the "db.transaction" method. However, you put that code alone, so, I must ask if yo uare sure that "tx" is defined, since, out of the referred callback, probably "tx" is undefined or don't have the expected reference. Are you sure that the plugin did not allow to make SELECT questies without using "tx"? Because I don't know why to use a transaction in a SELECT query...
About your latest problem, if I am not wrong, what happen is that the app try to load a non existing app view. You must save the app, and then compile it, in order to assert that all the app views are properly compiled and therefore available to be load by the app.
Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.