Because I needed a “Backup of edited records”, I saved them into a array using the method: databaseManager.getEditedRecords( fs ). This also includes the new created records. The problem now is, that the JSRecord method: getChangedData( ) only serves data for edited records that have an old value, but not for new records.
Why this method does not provide data for new records? I think, it would be useful if for new records the old value is just empty.
you can just use databaseManager.hasNewRecords(record).
If this returns true, loop over the dataproviders in your record and use the actual values.
mboegem:
you can just use databaseManager.hasNewRecords(record).
If this returns true, loop over the dataproviders in your record and use the actual values.
I found this solution, but I think it would be simpler if I could get the new values by the getChangedData( ) method, because I already looped through the changed / edited records. Now I have to do two different things to backup the edited and new created records, but it would be possible to do this, if the method would provide the new values also for new records.
The source problem was that I want to omit a record, but it seems that the omitRecord( ) does not not work if another record is already changed. So I’m in the need to revert all changes to the old values, omit a record and then revert the edited records to the new values.
But if the user created a new record the new record is lost, because I get no changed data for new records.
I’m in the need to omit a record, because of this problem.
deezzub:
Now I have to do two different things to backup the edited and new created records
If everything was as easy as doing it all from one function, I think we wouldn’t even need programmers… ![Smile :-)]()
Anyway, you can still use the same loop to go through your records either edited or new.
At each iteration, test whether the record is new or not:
- true: loop over the columns in your table and do whatever you want to do.
- false: execute your current code.
Instead of waiting for a ‘one key’ solution I’d suggest to just write this piece of code.
It will take you probably 10 minutes max. to do this and your problem is solved…