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: 
sushil353
Master II
Master II

how can i store a total no of rows of a straight table in a variable?

Hi All,

I have a straight table. i want to store the no of rows in a variable. how can i achieve this?

Thanks

Sushil

1 Reply
Not applicable

One way you could work around this is to create a variable in the script:

If you had a table named table.

Let a = NoOfRows('table')

A more complicated way that doesnt involve the script involves the use of a macro.

Create a new variable called NoOfRows, leave the definition blank.

Open up the macro menu and type in the following:

sub temp

set obj = ActiveDocument.GetSheetObject("CH01*")

ActiveDocument.Variables("NoOfRows").SetContent obj.GetRowCount, true

end sub

*Note that you will name this the object ID of whatever your straight table is.

Now open up settings->Document properties...->OnAnySelect**->Add Actions...->External->Run Macro->Macro name is temp then apply down the list.  Now whenever you make a selection it will store the number of rows from "CH01" or whatever your straight table is into the variable NoOfRows.

**Keep in mind you can change when the macro gets run for your preferences by defining the same thing for OnOpen, etc..

I have attached a working .qvw for additional support

Hope this helps!