Question about search

Hello,

I use the follwing procedure

→ show a base form (-> autosave = off)
→ new record
→ show modal form to select a record with related information
→ find/search
→ select record in modal form and copy fields to base form

When i do the find / search on the modal form, it seems that servoy
does a saveData on the base form. This gives an error because required fields are still null.

Is this correct ?? and is so why this behaviour ??

Hi Hans,

Does this search form use the same table or is it in anyway related to the form you are inserting data into ?
If so you might want to use a seperate foundset on your search form so only that form will go into find mode.

Hope this helps.

Hi,

No they are not related, and i use separate foundset.

It looks like it is standard behaviour that Servoy does
a saveData when autosave is off and you do a search
on any form.

If this is true, i realy have a problem.

Can one of the Servoians answer this one ?

Regards

What if you load the foundset by using SQL instead of a regular search ?
More of a workaround if this is indeed the standard behavior but it might help you further.

Thanks Robert !!!

Will try that.

Hi Robert,

Works like a … , Thanks very much. You saved my day !!!

changed :

forms[_FormName].controller.find()
forms[_FormName].pers_achternaam = '#' + globals.search + '%'
forms[_FormName].controller.newRecord()
forms[_FormName].bedr_naam = '#' + globals.search + '%'
forms[_FormName].controller.newRecord() 
forms[_FormName].rltp_naam = '#' + globals.search + '%'
forms[_FormName].controller.search()

into :

var args = new Array();
args[0] = '%' + globals.search + '%';
args[1] = '%' + globals.search + '%';
args[2] = '%' + globals.search + '%';
forms[_FormName].controller.loadRecords('select perrol_id from val_persoonsrollen where upper(val_persoonsrollen.rltp_naam) like upper(?) or upper(val_persoonsrollen.pers_achternaam) like upper(?) or upper(val_persoonsrollen.bedr_naam)  like upper(?)',args);

Hi Hans,

I am glad this works for you. :D
Still it’s strange that using the regular search triggers the savedata. I guess changing the state of the form triggers it and not the search itself because in essence with pure SQL we do the same thing.
Hopefully one of the Servoy developers can comment on this if this is by design or a bug.
And if it’s by design could it be changed.

Maybe you should add this to the support system so they can track this issue.

Hi,

I have build a small sample solution that reproduces the problem.
I will wait for a reaction of one of the Servoy Developers.
If it looks like a bug, i will create a support case.

Regards,

Hans,

Currently, using find/search in Servoy acts over the entire user interface.
Going into find mode is not just a local change for the current form, but affects all forms. So if you start find in a modal form the main form also changes state and has to save its outstanding data.

We will look into changing this in the future to make find/search local for the current form only.

Rob

Thanks Rob.

b.t.w. it is not the Find but the Search that causes the saveData.

In my opinion this behaviour should be changed, because it overrules the
autosave:off / transaction model.

It should always be possible to do a query without saving changed records.
If the Find is on the same table it will not work anyway, this is already standard Servoy behaviour.

I will create a support case for this one.

Regards,

Hans

Got an answer from servoy on the case I created :

Status: closed-won’t fix
Resolution:
all unsaved records are in in one pool, and have to be saved before search, since they might influcence the search! (records can have related data which are relaed to the search you try todo)