Using autosave OFF and using find

I have a serious problem with Servoy in the following situation:

The documentation describes a situation which happens often in my application and I see no solution.

Initiates a related find request; returns true if the find is successful; find will fail if autosave is disabled and there are unsaved records.

I have this kind of situation. I want to add a new order in my ordertable. My AutoSave is OFF, because records can only be written to the database when pressing OK button.

When adding an order, I have to enter a customercode. Since I don’t know the customercode, I want to give the user a selectionscreen where the user can enter a part of the customercode, but also part of the name, address, city etc.

So to create a foundset with records that fit this selection, I’m doing a find() on a foundset:

var _foundset = databaseManager.getFoundSet(globals.sec_db_connection, 'relations')

if (_foundset == null)
	return null;

globals.search_criteria = _searchcriteria

application.output('onFind: AutoSave=' + databaseManager.getAutoSave())
application.output('onFind 1: ' + _foundset.isInFind())
_foundset.clear();

// Go to findmode and enter the fields where you want to search on
application.output('onFind 2: ' + _foundset.isInFind())
var _success = _foundset.find()
if (_success == false)
	return null;
	
application.output('onFind 3: ' + _foundset.isInFind())
_foundset['relation_code'] = '%' + _searchcriteria + '%'
application.output('onFind 4: ' + _foundset.isInFind())
_foundset.newRecord(false , true)
application.output('onFind 5: ' + _foundset.isInFind())
_foundset['name'] = '%' + _searchcriteria + '%'
application.output('onFind 6: ' + _foundset.isInFind())
_foundset.newRecord(false , true)
_foundset.relations_to_relation_address['streetname'] =  '%' + _searchcriteria + '%'
_foundset.newRecord(false , true)
_foundset.relations_to_relation_address['postal_code'] =  '%' + _searchcriteria + '%'
_foundset.newRecord(false , true)
_foundset.relations_to_relation_address['city'] =  '%' + _searchcriteria + '%'
application.output('onFind 7: ' + _foundset.isInFind())
_foundset.search(true, false)
application.output('onFind 8: ' + _foundset.isInFind())
return _foundset

The problem is that the find() fails because I have a non-saved record (the newRecord() on the order).

But in my opinion the find-mode for the mainform (order) is not the same find as on my foundset to select a customer. I do directly a find on a foundset that I created myself using the databaseManager and not a find on the controller. Can this be separated?

And is there another way I can make such a find construction, without using queries?

yes the going in to find on a foundset had still a bit to much of a restriction in 3.5.2. This is already solved for the next release (3.5.3)