For each workstation that utililizes our solution, we have specific settings that our solution will reference as the user moves through the solution.
I am creating a method that finds all the settings for a particular workstation and then throws them into a global varaible as an array… so we can use whenever.
Arrays make sense to me, but looping doesn’t yet. How would a Servoy Pro approach this?
Find the workstation records (based on mac address) — I have this part down
Loop through the found set and set the param and value column into the array
I don’t really understand what the problem is. From what I understand you want to do, you could consider using an Object rather than an array, because that is easier to “query”. For example
// Create Object
globals.settings = new Object();
// Create a property "macAddress"
globals.settings.macAddress = '00-00-00-00-00-00-00-E0';
...
You can query then as
// Get Mac address; make sure the global is set
if (globals.settings) {
var vMacAddress = globals.settings.macAddress;
}
With an array, it should work like this
globals.settings = new Array();
globals.settings[0] = ['mac address', '00-00-00-00-00-00-00-E0'];
then you could loop over that
for (var i = 0 ; i < globals.settings.length; i++) {
if (globals.settings[i][0] == 'mac address') {
var vMacAddress = globals.settings[i][1]
}
}
For each workstation, there will be several records that store the settings for that workstation. The MAC Address is what we’re thinking of using to indentify the workstation’s settings.
OK. I got that. Every client has its records. So why do you want to put this in a global? You could, for example, make one global where you put the MAC address of a specific client on startup of your solution. The you create one relation from that global to your settings table. Now you can always access a foundset with just the settings for that client. No need to put all the records in a global…