You need to understand the difference between $order and $query; they both handle globals/arrays differently for different purposes.
$order is the more straightforward to use (and more commonly used); it scans down a particular node of a global/array. For example for your example:

`set n=""

for{

set n=$order(^TestGlobal("Not Configured",n))

quit:n=""

; do something with n

} `

$query is more useful if the global structure is unknown or less structured. It starts at the top of the global and returns the entire subscript string at a given level. So again for your example, the first $query would return ("Not Configured","Value 1"). You could then use $QL to get the number of subscripts at that level (2 in this case), and $qs(subscripts,position) to get the value of the subscript.

set gbl="TestGlobal"
set node=$q(@gbl@(""))
w node ; this would return TestGlobal("Not Configured","Value 1")
w $ql(node) ; this would return 2
w $qs(node,1) ; this would return "not configured"
w $qs(node,2) ; this would return "Value 1"
w @node ; returns the data at that node; in this example null

$order is the more commonly used.

You need to understand how to use globals and arrays to efficiently store data, and how to traverse them using $order. Globals and arrays are handled the same except globals are store on disk (persistant/permanent) and arrays are stored in memory (volatile/temporary).

Hope this helps.