Finding number of rows of the table dynamically on selection

In Qlikview, row numbers can be calculated either from the script or Designer end. To show in table we need to add a calculated expression, this show each number in the row. We will not add this column as mandatory in the entire table, but we can have a single text box to show the number of rows dynamically on selection.

This functionality can be achieved using below VB macro.

The Chart ID needs to be passed from the UI to the macro.

Sub NoOfRows
chartID =ActiveDocument.Variables(“vChartID”).GetContent.String


‘’’Checking the chart ID variable has value or not. If yes then calculate the no of rows for that object

IF chartID<>”” then
set chart = ActiveDocument.GetSheetObject(chartID )
ActiveDocument.Variables(“vRowsCount”).SetContent chart.GetNoOfRows, true

‘’’ If there is not chart object then exit the macro

exit sub
end if
end Sub


You can set the action in triggers on any selection in document properties to make the macro calculation dynamic on selection.

No Comments

Leave a Comment

Your email address will not be published.