Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
omerfaruk
Creator
Creator

QlikView Ajax - GetAllObjects function in a loop doesn't operate properly

Hi,

I'm trying to get all obejcts in several documents. I have following code but It doesn't work properly. While loop iterates firstly omitting the GetAllObjects function, and then it operates the function. How could this be solved?

function fillArray()

    {

     var ln = docNames.length - 1;

        while (ln > 0)

        {

            myArray[ln] = [];

            var doc = Qv.GetDocument(docNames[ln]);

          

            doc.GetAllObjects(function (objects)

            {

                alert("Inside GetAllObjects");

                for (var i = 0; i < objects.length; i++)

                {

                    alert("Inside For. j=" + j + " and i=" + i);

                    myArray[ln] = [];

                    var obj = objects;

                    var id = obj.id;

                    var caption = obj.caption;

                    var type = obj.type;

                    myArray[ln][0] = docName;

                    myArray[ln][1] = id;

                    myArray[ln][2] = caption;

                    myArray[ln][3] = type;

                }

            });

            ln = ln-1;

        }

}

0 Replies