Is it possible to delete a JSRecord from foundset, but hold it in memory as type of JSRecord?
Hi Sebastian,
deezzub:
Is it possible to delete a JSFRecord from foundset, but hold it in memory as type of JSRecord?
Not sure what a JSFRecord is, I think you mean JSRecord.
A JSRecord is very much linked to the foundset so I don’t think you can disconnect it and still call it a JSRecord.
What are you trying to accomplish ?
ROCLASI:
Hi Sebastian,deezzub:
Is it possible to delete a JSFRecord from foundset, but hold it in memory as type of JSRecord?Not sure what a JSFRecord is, I think you mean JSRecord.
A JSRecord is very much linked to the foundset so I don’t think you can disconnect it and still call it a JSRecord.
What are you trying to accomplish ?
Hello Robert, yes I mean JSRecord. We need to update FoxPro DBF tables because, we can not completely switch to new SQL database, if a record is added, edited or deleted in MS SQL table. I use the selected record from Servoy, to find the matching record in the DBF table. In the case of deletion I cannot delete the record in Servoy because than I loose the information, which record in the DBF table should be deleted and I want delete the record in the DBF table after deletion in Servoy, because I have to restore the record In DBF if deletion in Servoy fails.
Of cource, I can pass the row ident column name and value to delete the record, but then I also need to pass table name. So in this case it would great to delete the JSrecord in Servoy, but have in memory.
Also, I had cases before, where I needed such inmemory jsrecords. I think, it would be give a lot flexibilty for the developer.
As a workaround I created my own in-memory record.:
/**
* Create an in-memory record from a JSRecord.
*
* @param {JSRecord} jsRecord , the jsRecord which should be converted to an
* in-memory record.
* @constructor
*
* @public
* @since 01.09.2014
*
* @author Sebastian Schlatow
*/
function JSRecordInMen( jsRecord ) {
var /** @type {String[]} */
dataproviders = [ ],
dataprovidersLength = 0,
dataproviderIndex = 0;
if ( jsRecord ) {
dataproviders = jsRecord.foundset.alldataproviders;
dataprovidersLength = dataproviders.length;
this.originDataSource = jsRecord.getDataSource( );
this.pks = jsRecord.getPKs( );
this.foundset = { };
this.foundset.alldataproviders = dataproviders;
this.getDataSource = function ( ) {
return this.originDataSource;
};
for ( dataproviderIndex = 0; dataproviderIndex < dataprovidersLength; dataproviderIndex++ ) {
this[ dataproviders[ dataproviderIndex ] ] = jsRecord[ dataproviders[ dataproviderIndex ] ];
}
}
}