Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

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

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.

Dave Troxel
Posts: 0
Joined: Fri May 09, 2014 1:07 pm

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

I cannot get past launching the remote debugger. Image

Dave Troxel
Posts: 0
Joined: Fri May 09, 2014 1:07 pm

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

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)
Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

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

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

Dave Troxel
Posts: 0
Joined: Fri May 09, 2014 1:07 pm

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

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?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

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

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.

Dave Troxel
Posts: 0
Joined: Fri May 09, 2014 1:07 pm

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

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?

Dave Troxel
Posts: 0
Joined: Fri May 09, 2014 1:07 pm

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

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;

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

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

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.

Dave Troxel
Posts: 0
Joined: Fri May 09, 2014 1:07 pm

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

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

Return to “Issues”