There is probably a simple explanation/fix for our problem…
We have a method, Find_Number_of_Buttons, that runs on our parent form. It calls up to 5 other methods to fill the uder defined buttons in 5 tabpanels. We have 5 tabpanels because each panel is limited to 10 buttons. So buttons 1-10 go in tabpanel 1, 11-20 gp in tabpanel 2, etc. The problem is the code is really slow. To loop through the records and get the appropriate buttons for each tabpanel takes 3-4 seconds. The foundset is currently 41 records. Below is the code.
// find buttons based on provider…need to add
forms.uti_Objective_Heading.controller.loadAllRecords()
forms.uti_Objective_Heading.controller.find();
forms.uti_Objective_Heading.display_name = ‘!^=’;
forms.uti_Objective_Heading.controller.search();
var headingid = forms.uti_Objective_Heading.foundset.selectRecord(forms.uti_Objective_Heading.objective_headingid)
elements.tab_1_10.visible = false;
elements.tab_11_20.visible = false;
elements.tab_21_30.visible = false;
elements.tab_31_40.visible = false;
elements.tab_41_50.visible = false;
var numberOfButtons = forms.uti_Objective_Heading.foundset.getSize();
//Sort ascending or decending, use sort dialog to get the sort string via ‘copy’ button
forms.uti_Objective_Heading.controller.sort(‘list_number asc’);
var dupset = forms.uti_Objective_Heading.controller.duplicateFoundSet();
var CountButtons = Math.ceil(numberOfButtons/10)
switch( CountButtons )
{
case 0:
break;
case 1:
forms.Objective_Btns_1_thru_10.Load_Buttons_1_to_10(dupset);
break;
case 2:
forms.Objective_Btns_1_thru_10.Load_Buttons_1_to_10(dupset);
forms.Objective_Btns_11_thru_20.Load_Buttons_11_to_20(dupset);
break;
case 3:
forms.Objective_Btns_1_thru_10.Load_Buttons_1_to_10(dupset);
forms.Objective_Btns_11_thru_20.Load_Buttons_11_to_20(dupset);
forms.Objective_Btns_21_thru_30.Load_Buttons_21_to_30(dupset);
break;
case 4:
forms.Objective_Btns_1_thru_10.Load_Buttons_1_to_10(dupset);
forms.Objective_Btns_11_thru_20.Load_Buttons_11_to_20(dupset);
forms.Objective_Btns_21_thru_30.Load_Buttons_21_to_30(dupset);
forms.Objective_Btns_31_thru_40.Load_Buttons_31_to_40(dupset);
break;
case 5:
forms.Objective_Btns_1_thru_10.Load_Buttons_1_to_10(dupset);
forms.Objective_Btns_11_thru_20.Load_Buttons_11_to_20(dupset);
forms.Objective_Btns_21_thru_30.Load_Buttons_21_to_30(dupset);
forms.Objective_Btns_31_thru_40.Load_Buttons_31_to_40(dupset);
forms.Objective_Btns_41_thru_50.Load_Buttons_41_to_50(dupset);
break;
}
//////////////////// It calls the following methods /////////////////////////
//forms.Objective_Btns_1_thru_10.controller.show()
var dupset = arguments[0];
forms.Objective_Btns_1_thru_10.controller.loadRecords(dupset);
forms.Objective_Btns_1_thru_10.controller.sort(‘list_number asc’)
//TODO: check getSize to be greater then 10
var recordSize = foundset.getSize()
if (recordSize > 10)
{
forms.Enter_Objective.elements.tab_1_10.visible = true;
for ( var i = recordSize; i > 10 ; i-- )
{
//select record
forms.Objective_Btns_1_thru_10.controller.setSelectedIndex(i)
//omit record
forms.Objective_Btns_1_thru_10.controller.omitRecord()
}
}
//////////////////11 through 20 below//////////////////////////////
//forms.Objective_Btns_11_thru_20.controller.show()
var dupset = arguments[0];
forms.Objective_Btns_11_thru_20.controller.loadRecords(dupset);
forms.Objective_Btns_11_thru_20.controller.sort(‘list_number asc’)
//TODO: check getSize to be greater then 20
var recordSize = forms.Objective_Btns_11_thru_20.foundset.getSize()
for ( var i = 10 ; i > 0 ; i-- )
{
forms.Objective_Btns_11_thru_20.controller.setSelectedIndex(i);
forms.Objective_Btns_11_thru_20.controller.omitRecord();
}
recordSize = forms.Objective_Btns_11_thru_20.foundset.getSize()
forms.Enter_Objective.elements.tab_11_20.visible = true;
if (recordSize > 10)
{
for ( var i = recordSize ; i > 10 ; i-- )
{
//select record
forms.Objective_Btns_11_thru_20.controller.setSelectedIndex(i)
//omit record
forms.Objective_Btns_11_thru_20.controller.omitRecord()
}
}
The methods for buttons 21-30, 31-40, and 41-50 are similar to the last method.
The forms for the tabpanels are all based on the same table but each one has its own foundset.
I don’t understand why the method is slow. Is there a better way to approach this problem? Is there a technique analagous to Filemaker’s 1-10, 11-20, 21-30 option for portals? Thanks.
Reed