Page 2 of 3

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

Posted: Fri Jun 06, 2014 12:25 pm
by Kateryna Grynko

Hi Dave,

You need to use developer tools for debugging your application: http://devcenter.appery.io/documentat...
Your application contains some errors:
Image
Let's fix them and then go ahead.


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

Posted: Fri Jun 06, 2014 1:03 pm
by Dave Troxel

I cannot get past launching the remote debugger. Image


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

Posted: Fri Jun 06, 2014 2:26 pm
by Dave Troxel

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.

Image

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.

  1. if (results.rows.length == 0)

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

Posted: Fri Jun 06, 2014 6:21 pm
by Evgene Karachevtsev

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


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

Posted: Fri Jun 06, 2014 6:31 pm
by Dave Troxel

Evgene, I can easily remove the return.

But I haven't a clue what you are talking about pertaining to the undeclared variable value. I don't know what to assign nor where to put it.

Can you give me an example?


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

Posted: Fri Jun 06, 2014 9:07 pm
by Kateryna Grynko

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.


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

Posted: Fri Jun 06, 2014 11:08 pm
by Dave Troxel

Again, I need an example of what to change and where to put it. I have no idea what you are telling me.
Do I change value.id to something like onClick.id? What if I don't really have an onClick event take place?


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

Posted: Sat Jun 07, 2014 1:37 pm
by Dave Troxel

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;


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

Posted: Mon Jun 09, 2014 9:30 am
by Kateryna Grynko

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.


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

Posted: Mon Jun 09, 2014 12:44 pm
by Dave Troxel

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){