Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Nested arrays
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00107969
Message ID:
00107970
Views:
15
Hi Larry,

Yes an array element can point to another array element. Well... I need to re-phrase that statement. We can make an array element point to another array element.

Arrays can have .null. values and nulls can point to objects, so if your array is defined in an object you can achieve it.

Look at this example:
LOCAL laParent[3]
laParent = .null.
laParent = CREATEOBJECT('ChildArray')
	
DEFINE CLASS ChildArray as line
	DIMENSION aChild[3]
	
	FUNCTION INIT()
		this.aChild = 'Data'
	ENDFUNC
	
ENDDEFINE	

The debugger will show you the way you would want to see the information. Though simply issuing
? laParent[1]	
will return an error because it is an object reference to an array. You might want to wrap your array elements using ISNULL() or TYPE()... just in case you allow a mix of object references and data items.

Interestingly, you could use ACOPY to a variable and it still works the same way.
Previous
Reply
Map
View

Click here to load this message in the networking platform