Well, I can't say what's wrong, without knowing the hierachy of you form. But I can already see some problems in your script.
1. DON'T name variables or form objects (subforms, fields …) after scripting properties or default form elements! That's a no go and can cause very strange effects! So you better use other names than "data" or "length".
2. This script will either return 0 or 1. It depends on, if the an element DATA below GT_TABLE below the fourth subform below the third subform below the first subform under the element data exists or nor. I think not, aand that would be, why you don't see the "Hi" message.
// bad variable name "length", bad element name "data"! resolveNodes() will return 0 or 1 using this SOM expression.
var length = xfa.resolveNodes("data.#subform.#subform.#subform.GT_TABLE.DATA").length;