Dynamic value list based on global variable doesnt change

Questions, tips and tricks and techniques for scripting in Servoy

Dynamic value list based on global variable doesnt change

Postby dpearce » Sat Jul 25, 2009 8:25 pm

Hi,

I have a value list which is dynamic based on the value of a global variable, which i use to limit the list based on the type of entity.

I have solicitors, referrers and agencies, all in the same table which operates.

My value list works fine the first time you bring up the selection box and enter a 'type value' using the said script.

Code: Select all
globals.value_list_filter='Solicitor'
globals.input_temp_int1=0
databaseManager.saveData()
application.showFormInDialog(forms.dialogue_choose_solicitor,-1,-1,-1,-1,'Choose Solicitor',false,true,'choose',true);


This correctly brings up the list of only solicitors from the providers table as the value list is based on a limit using the field globals.value_list_filter.

When i fire up the same dialogue from another button on the same form, changing the value of globals.value_list_filter to 'Referrer', then the value list stubbornly stays in its initial form.
Code: Select all
globals.value_list_filter='Referrer'
globals.input_temp_int1=0
databaseManager.saveData()
application.showFormInDialog(forms.dialogue_choose_solicitor,-1,-1,-1,-1,'Choose Referrer',false,true,'choose',true);


I am assuming that the first list is kept in memory and the change of global variable is not recalculating the list.

Is there something i can do to force this to happen?

Using 3.5.10

David
dpearce
 
Posts: 469
Joined: Sun Dec 03, 2006 11:53 am

Re: Dynamic value list based on global variable doesnt change

Postby dpearce » Sun Jul 26, 2009 11:14 am

In the spirit of answering your own question. I have found a solution.

If i force a found set update before bring up the window with the valuelist based on my choice of type then it works:

Code: Select all
globals.value_list_filter='Solicitor'
globals.input_temp_int1=0
var fsUpdater = databaseManager.getFoundSetUpdater(forms.DEV_oranisations_providers.filtered_solicitor_oranisations_providers_to_providers)
fsUpdater.setColumn('type',globals.value_list_filter)
fsUpdater.performUpdate()

application.showFormInDialog(forms.dialogue_choose_solicitor,-1,-1,-1,-1,'Choose Solicitor',false,true,'choose',true);
dpearce
 
Posts: 469
Joined: Sun Dec 03, 2006 11:53 am


Return to Methods

Who is online

Users browsing this forum: No registered users and 35 guests

cron