# loadrecords(fs)

**URL:** https://forum.servoy.com/t/loadrecords-fs/14734
**Category:** Classic Servoy
**Created:** [September 26, 2011, 2:57am UTC](https://forum.servoy.com/t/loadrecords-fs/14734 "2011-09-26T02:57:47Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![rogel](https://avatars.discourse-cdn.com/v4/letter/r/c67d28/32.png) [@rogel](https://forum.servoy.com/u/rogel)
#### Post date: [September 26, 2011, 2:57am UTC](https://forum.servoy.com/t/loadrecords-fs/14734/1 "2011-09-26T02:57:47Z")

</div>

hi!

would like to seek help on this. mainTableFoundset.loadRecords(tempTableFoundset) return false. i am using servoy6. no errors in the log. =(

```auto
function onActionRestore_DB() {
	databaseManager.setAutoSave(false);
	
	createTempTable("customercontact","TEMP_customercontact");
	
	var mainTableFoundset = databaseManager.getFoundSet(dbServerName,"TEMP_customercontact")
	var tempTableFoundset = databaseManager.getFoundSet(dbServerName,"customercontact")
	
	tempTableFoundset.loadAllRecords();
	mainTableFoundset.loadRecords(tempTableFoundset)
	databaseManager.saveData(mainTableFoundset)

```

```auto
function createTempTable(tableName, tempTable) {
	
	var server = plugins.maintenance.getServer(dbServerName);		
	var tempTableObject = server.createNewTable(tempTable);
	var mainTable = server.getTable(tableName);
	var mainTableColumns = mainTable.getColumnNames();
	for (var indexMainTableColumns = 0; indexMainTableColumns < mainTableColumns.length; indexMainTableColumns++) {
		var mainTableColumn = mainTable.getColumn(mainTableColumns[indexMainTableColumns])
		tempTableObject.createNewColumn(mainTableColumn.getSQLName(),mainTableColumn.getType(),mainTableColumn.getLength(),mainTableColumn.getAllowNull(),mainTableColumn.isRowIdentifier())
	}
	return server.synchronizeWithDB(tempTableObject)
}

```

---

<div class="post-metadata">

### Author: ![rgansevles](https://avatars.discourse-cdn.com/v4/letter/r/3d9bf3/32.png) [@rgansevles](https://forum.servoy.com/u/rgansevles)
#### Post date: [September 26, 2011, 7:03am UTC](https://forum.servoy.com/t/loadrecords-fs/14734/2 "2011-09-26T07:03:48Z")

</div>

rogel,

You can only copy from one foundset to the other when both have the same data source.

Why do you have to work in a temp table?

I guess with autosave off you could also work in a foundset in the main table, all updates/inserts (not deletes!) are postponed until save.

Rob

---

<div class="post-metadata">

### Author: ![rogel](https://avatars.discourse-cdn.com/v4/letter/r/c67d28/32.png) [@rogel](https://forum.servoy.com/u/rogel)
#### Post date: [September 26, 2011, 7:08pm UTC](https://forum.servoy.com/t/loadrecords-fs/14734/3 "2011-09-26T19:08:17Z")

</div>

> rgansevles:  
> rogel,
> 
> You can only copy from one foundset to the other when both have the same data source.
> 
> Why do you have to work in a temp table?
> 
> I guess with autosave off you could also work in a foundset in the main table, all updates/inserts (not deletes!) are postponed until save.
> 
> Rob

I am doing a web service restore (full/partial data) from a backup SQL files functionality. We have 100+ tables to restore. I am doing a temp table to process(delete and inserts from backup SQL file, and possible update if the insert fails if pk exists) before I return to the main table.
