Alena,
Thank you for your e-mail.
When I add the javascript implementation to the DataService Mapping,the routine is not getting called. So I added this to the DataService Complete event. Will this approach work or should I investigate why the javascript is not getting called as illustrated in the tutorial?
When the javascript gets called from the dataservice complete event, I can see a local db created. All the elements are match - between the rest service and create db as well as insert. Any suggestions?
Thank you
var db = window.openDatabase("Clients 0.1", "", "Clients 0.1", 1024 * 1000);
console.log('pass1');
db.transaction(function(tx) {
tx.executeSql('CREATE TABLE IF NOT EXISTS Clients (ClientID TEXT, ClientName TEXT, Address TEXT, BirthDate TEXT, GenderDescription TEXT, StaffID TEXT, Zipcode TEXT,_createdAt DATETIME, _updatedAt DATETIME)');
tx.executeSql('SELECT * FROM Clients WHERE ClientID = "' + value.ClientID + '"', 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 Clients (ClientName, Address, BirthDate, GenderDescription, StaffID, Zipcode, _createdAt, updatedAt) values (?, ?, ?, ?, ?, ?, ?,?)', [value.ClientName, value.Address, value.BirthDate, value.GenderDescription, value.StaffID, value.Zipcode, value.createdAt, value._updatedAt]);
}
});
});
return;