所以我有以下问题: 我有一堆带有大量记录的Foundset,我想(深入)将它们复制到一个新位置,包括所有值但没有ID。最好的方法是什么?
答案 0 :(得分:1)
如果您想对发现集进行深层复制,则需要执行以下步骤:
retrieveOrCreateFoundset()
rec.dataprovider()
rec.value()
完整的代码示例如下:
var vMobileController = plugins.iBizClientWebService.mobileController();
var vFoundset = vMobileController.currentFoundset();
var vDatabaseManager = vMobileController.dataManager();
var copyFoundSet = vDatabaseManager.retrieveOrCreateFoundset("<datasource>:<label>");
for (var index = 0; index < vFoundset.size(); index++) {
var rec = vFoundset.record(index);
var loc = copyFoundSet.newRecord();
var newRecord = copyFoundSet.record(loc);
var allDataproviders = rec.dataprovider();
for(var i=0;i<allDataproviders.length;i++)
{
var dataProvider = allDataproviders[i];
var dataValue = rec.value(dataProvider);
if(dataProvider != "attribute_id")
{
newRecord.setValue(dataProvider, dataValue);
}
}
}
copyFoundSet.saveData();