Optimising Database Display
Hello,
I have a very specific problem that i am trying to tackle. I am trying to make something of a manual for spare parts for several machines at work and i want to make it into a pdf form. I have made the sheet and using javascript organised all the textboxes the way i need to but when i try to populate each box the document lags like crazy. I need some guidance on how to optimise it. let me elaborate. I have a combo box with all the machines "machine_1, machine_2... _7" i also have another combobox listing the sub-parts of the saind machine "machine_1_1, machine_1_2... _1_10" i also have a list of fiedls that need to be populated. I have set it in such a way that every time i chose a machine from the first combo box a script it activated to reset all of the used fields "function ResetMachines()
{
this.resetForm ([
"Machine.1.Level",
"Machine.1.Title",
"Machine.1.Description",
"Machine.1.Title_02",
"Machine.1.Description_02",
"Machine.1.Title_03",
"Machine.1.Description_03",
"Machine.1.Title_04",
.....
"Machine.6.Level",
"Machine.6.Title",
"Machine.6.Description",
"Machine.6.Title_02",
"Machine.6.Description_02",
"Machine.6.Title_03",
"Machine.6.Description_03",
"Machine.6.Title_04",
"Machine.6.Description_04"]);
}"
afterwads the second combobox calls out a script to populate them.
function partsMachines(Machines) {
var partsMachines = Circle[Machines];
// Loop through each field and populate if empty
for (var i = 1; i <= 6; i++) {
var fieldPrefix = "Machines." + i + ".";
var levelField = this.getField(fieldPrefix + "Level");
var titleField = this.getField(fieldPrefix + "Title");
var descriptionField = this.getField(fieldPrefix + "Description");
var title02Field = this.getField(fieldPrefix + "Title_02");
var description02Field = this.getField(fieldPrefix + "Description_02");
var title03Field = this.getField(fieldPrefix + "Title_03");
var description03Field = this.getField(fieldPrefix + "Description_03");
var title04Field = this.getField(fieldPrefix + "Title_04");
var description04Field = this.getField(fieldPrefix + "Description_04");
levelField.value = partsMachines["Machines_" + i + "_Level"];
titleField.value = partsMachines["Machines_" + i + "_Title"];
descriptionField.value = partsMachines["Machines_" + i + "_Description"];
title02Field.value = partsMachines["Machines_" + i + "_Title_02"];
description02Field.value = partsMachines["Machines_" + i + "_Description_02"];
title03Field.value = partsMachines["Machines_" + i + "_Title_03"];
description03Field.value = partsMachines["Machines_" + i + "_Description_03"];
title04Field.value = partsMachines["Machines_" + i + "_Title_04"];
description04Field.value = partsMachines["Machines_" + i + "_Description_04"];
}
It all works as intended but it is so slow and laggy that i don't think it is usable. I know i am pushing the limit of the whole pdf javascript capabilities but i am also sure there is a better way to optimise this. Any ideas?