Just a simple JS question, please be patient with me as I'm new to this :)
I am passing 2 variables to the findRelatedRecords function which queries other related tables and constructs an Array of Objects called data. Due to the many inner functions in findRelatedRecords, I am struggling to retrieve the data Array from the function.
Currently, I call showWin inside findRelatedRecords, but my goal is to modify it so that I can directly extract the data Array out of findRelatedRecords without having to go through showWin.
function findRelatedRecords(features, evtObj){
// Function code goes here...
}
function newFunction(){
var newData = findRelatedRecords(feature, evt);
console.log(newData);
}
Is there a way to achieve this?
Thank you!
Edit:
Additional explanation...
I am linking an Object event Listener to a Function like this:
function mainFunction(input){
dojo.connect(object, "onQueryRelatedFeaturesComplete", getData);
object.queryRelatedFeatures(input);
console.log(array); // This doesn't work
}
function getData(relatedFeatData){
var array = [];
// Populate the array
return array;
}
When object.QueryRelatedFeatures() is complete, getData is triggered; this part works well, but how do I access the 'array' from the mainFunction?