Servoy 7.4.1

Hi Johan,

jcompagner:
Thomas, as rob already explained this is not directly a problem in servoy, and you could just turn this error off (or make it just a warning) see the wiki page.

Ok, I have read this, but changing the server setting “servoy.server.throwErrorOnUnexpectedUpdateCount” to false is not saving the problem and I don’t get the log entry with the missing values, or?

jcompagner:
But it is better to look at the actual cause, because the code (the client) expects that it would update (or insert) a record into the database, but the database reports that nothing is really changed
So no record is updated or inserted, which should really have happened because an update or insert statement was send to the database to update a record.

So the question is should the update statement for that record really have happened for that client?
so look at the where part: where uid_auftrag = 40752 and uid_real_client_group = ‘client1’

does that where part hit a record? and if not why? is that auftrag record (with id 40752) really belonging to another client?

I have filtered the sql table by the record id and could find it. The record was created and stored to the sql table but without the data and over all the value for the table filter id (uid_real_client_group = ‘client1’).
As I understand is that the problem because of the table filter function. For a successful update the record id AND the table filter id is needed, or? But in my case, only the record id exists and the error occurs.

For me it is very difficult to understand how I could fix that. The error occurs sporadic currently only on one table. On perhaps one of five new records the client gets the error dialog “Cannot save data”.
In the code for creating a new record, the table filter id will be set even of newRecord() followed by a databaseManager.saveData(). Is there any other way to make this better?

Regards

you need to make sure, when you create a new record, it directly follows by setting your tenant-id and than do databaseManager.saveData()

so like this:

var record = foundset.getRecord(foundset.newRecord())
record.tenantid = ‘client1’
databaseManager.saveData(record)

when you switch the last two lines, you will get the error you mentioned, when you have databasefilters on tenantid active.

Thank you Harjo for your reply!

My code is similar to yours and of course I make the .saveData() AFTER setting the tenantid.
Anyway, I will get into my code again and modify it like your example if necessary.

Have a nice weekend!