Morley:
Now I’m REALLY confused. I’ve been using databaseManager.getFoundSetDataProviderAsArray for about a month and have never had any problems with it before. Testing with application.output(arrayName) has always returned a [1,2,3] type of result. That is, until I tried to use it within a FormInDialogue situation when I started to get this weird “[Ljava.lang.Object;@” response.
Morley:
Picking up now on Maarten’s recommendation of using application.output(arrayName[1]) I get yet a different form of response. It says “11.0”. What’s this mean? It’s definitely NOT the number of elements in the array. That number is considerably higher.
By the way, I also checked the Variables section of the debugger. It DOES list the required field elements in the array. It would now appear I’ve been getting a false positive for an error because I was relying on application.output(arrayName) to give me consistent feedback.
I want to understand what’s going on here. What’s this “[Ljava.lang.Object;@” stuff all about? Why does application.output(nameArray) sometimes output in the form [1,2,3] and sometimes as “[Ljava.lang.Object;@”? And what is the meaning of application.output(arrayName[1]) producing an answer of “11.0”?
I need to know so I can have a surer understanding of the ground I’m standing on. Thanks.
I can’t tell you why you get a [1,2,3] result back when you should get [Ljava.lang.Object;@etc. back.
Again…when you use application.output() you get the OBJECT back.
Yes you can DEFINE an array with arrays using [1,2,3] but as you can see it’s not a string. JavaScript turns it into an Array Object.
To read data out of an Array you need to tell it from what position in the array you want the data. This is what Maarten was talking about.
arrayName[1] means ‘give me the value in the array at the second position’ (Array’s are zero based).
So yes you can get a value 11.0. It means that the Array contained that value (eleven) in position 1 (second position in the array).
To make it more visible, here an example:
var myArray = [10,11,12];
application.ouput(myArray[0]);
→ 10.0
application.ouput(myArray[1]);
→ 11.0
application.ouput(myArray[2]);
→ 12.0
application.ouput(myArray[3]);
→ null
As you can see myArray[3] returns a null. Why? Because the array is not that long, there is no value at position 3 (fourth position in the array).
And like Maarten said. You can use the debugger to view variables (Variables tab).
Just make sure you enable the debugger, place a break right after the variable and run the method.
It instantly shows the variables and their values in the variables tab.
I hope this brief Array/Debugger primer helps you on your way.