Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
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;

        }

}

Labels (1)
0 Replies