Hi there,

Having an interesting time with a BIG project that I'm writing to output and manipulate DB data - that doesn't really matter to the question though.

What I'm trying to achieve is to create an array of objects with the properties of "name" and "value" from inside my main object (my uberObject as it were) with an object definition that is OUTSIDE of the main object. To clarify:

my fieldObject def:
Code:
function fieldObject(name, value) {
		this.name = name;
		this.value = value;
	}
and inside the recordManager object (main big object) I have a method makeSelectArray() as below:

Code:
this.makeSelectArray = function() {
		var selectArray = new Array;
		for (i=0; i<genFieldsArray.length; i++) {	
				if (genFieldsArray[i].includeInList == 'y')
				{	selectArray[i] = new fieldObject(genFieldsArray[i].name,'');	}
		}
		for (i=0; i<selectArray.length; i++) { Response.Write(selectArray[i].name+', '); }
		return selectArray;	
	}
The idea is to use this to create an array of fieldObjects from a general fields list (genFieldsArray) which is passed into the recordManager object on instatiation - this selectArray will then be used to generate a SQL string based on its name and value properties in a seperate method. Like so:

Code:
var selectArray = this.makeSelectArray();
this.thisSQL = this.makeSQL('select',selectArray,this.tableName,'deleted','Y');

My problem is that when I run this code, it doesn't seem to understand the fieldObject declaration - I get a "'name' is null or not an object" error for the line Response.Write(selectArray[i].name+', '); which I'm confused about because surely selectArray[i] is an object with "name" and "value" properties as per my fieldObject definition.

Does my problem lie in the fact that the fieldObject definition is outside the recordManager definition? ie a scope issue? if so, how do I fix?

Any help would be greatly appreciated! To see my full code so far, please click this link below:
http://www.ncri.org.uk/codetests/rec...Definition.txt
(is a txt file as the original is in ASP as you'll see)

I would also just say that this is my first attempt at OO coding on this grand scale - any general structure tips on the above code would also be greatly appreciated!!

Cheers!

Pixelz