Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to Get Selections From TableBox with JavaScript

Dear all,

I'm developing an ASPX-Website with including QlikView-Objects.

Following this thread: http://community.qlik.com/message/87561#87561

I've got selections from a listbox pretty well...

But how about selections from a tablebox?

Is there any way to achieve this?

I know there is a "current selections/status"-box available for QV-dashboards.

Is it possible to access this data? Or to capture the data which is sent this box?

I would really appreciate your help.

Thanks in advance...

Kind regards,

Patrick

1 Solution

Accepted Solutions
Not applicable
Author

            var currentSelectionsObjectId = "EXAMPLE_CS1";

            var currentSelectionsObject = qva.GetQvObject(currentSelectionsObjectId, function () {

                  var rows = currentSelectionsObject.QvaPublic.Data.Rows;

                  var numberOfRows = rows.length;

                  for (var i = 0; i < numberOfRows; i++) {

                       var selectedField = rows[0].text; 

                       // the second cell is undefined, the 3rd cell contains the summary string of the selected values

                       var summaryOfValues = rows[2].text; 

                  } 

            });

View solution in original post

5 Replies
Not applicable
Author

What version of QlikView are you using?

Not applicable
Author

You can retrieve the data from a Current Selections object. It is similar to how you would loop through data for a the table object; however, the Current Selections object has it's limitations... you will notice that if you select "n " number of values for a listbox field, the Current Selections only displays a certain number of values instead of what is selected. 

There are a couple of other approaches you can try...  1) Use the list box object and use the QvaPublic API's GetSelected() method.  That will return you an array of objects for all current selected values for that list box.  The problem with this is that you won't know what fields are selected.  2) you can create a table object that has the same field as the listbox and loop through it's data object as it only displays the vales that are currently selected.  Again same problem, you won't know what field was acutally selected.

What I've done in the past is used the Current Selections and List Box Object together.  Loop through the current selections object table to let you know which fields have been selected, then for each row get the list box associated with that field and then call the GetSelected() function.

I hope this makes since. I can send you a snippet of code for looking at the Current Selections.

Not applicable
Author

Hi Julius,

many, many thanks for your advice!

I would really like to see your snippet of code...

kind regards,

patrick

Not applicable
Author

            var currentSelectionsObjectId = "EXAMPLE_CS1";

            var currentSelectionsObject = qva.GetQvObject(currentSelectionsObjectId, function () {

                  var rows = currentSelectionsObject.QvaPublic.Data.Rows;

                  var numberOfRows = rows.length;

                  for (var i = 0; i < numberOfRows; i++) {

                       var selectedField = rows[0].text; 

                       // the second cell is undefined, the 3rd cell contains the summary string of the selected values

                       var summaryOfValues = rows[2].text; 

                  } 

            });

Not applicable
Author

thanks!