Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Number of rows in straight/pivot table into a variable?

I want to count the number of rows in a straight table (and also, in other applications, in pivot tables).

I went to the API cookbook, and it suggested:

SET table = ActiveDocument.GetSheetObject("CH03")

vTabHigh = table.GetRowCount

I thought this would be a script expression, but it's not. It's clearly not a chart expression, so I tried creating a macro:

Function TabHeight(tableID)

SET workingtable = ActiveDocument.GetSheetObject(tableID)

TabHeight = workingtable.GetRowCount

END Function

That was accepted by the macro editor, but it didn't work either - always returned NULL.

I want to know the number of rows so I can suppress printing in another program if number of rows = 0.

Thanks,

Kevin

15 Replies
Anonymous
Not applicable
Author

Yes, it should be very simple.  Some info is missing...  Make sure your typed the macro name correctly in all your actions.

Is it on Desktop or Server?  If server - what is the client, AJAX or IE Plugin?  I don't expect the macro to work in AJAX (or Web View).

Not applicable
Author

I agree this should be simple, which is why I am tearing out the very little hair I have left!

The macro name is pretty simple - KROWS, and I'm fairly certain I've typed it correctly. (Aside to QV: why, when I'm trying to assign a macro, doesn't the little dialog box bring up a list of the macros in the document, instead of an Expression entry box?).

This is strictly a Desktop environment. I know that macros don't work with Ajax (I'm uncertain about PSV..).

There are no EXTENSIONS associated with this document.

Under Security_> User Privileges, "Macro Override Security" is checked. (along with everything else, except

"Allow Print when export prohibited"

"Show All Sheets and Objects"

"Show Progress for Hidden Script"

"Admin Override Security"

I can't think of anywhere else that there might be something to change, but my knowledge has huge gaps.

Anonymous
Not applicable
Author

I hit the wall with guessing.  If a macro works from a button, there are no reason for it not to work on triggers...

Can you upload a reduced and scrambled example of your application?

Not applicable
Author

Ill try...

Anonymous
Not applicable
Author

Kevin,

The bad news is that your triggers work fine on my machine.  There is something in your environment that I can't guess.

Just in case, check what you have in Settings - User Preferences - Security.  I have all boxes checked there.

My QV version is 11.20 SR5, 64-bit, on Windows 7.

You maybe need to open case with Support.

Not applicable
Author

I thought I had everything checked, but I double-checked it, and even though I didn't make any changes,

it's working now! When I select a new date (OnSelect  field trigger is activated), the number now changes.

Thanks, Michael, for your assistance!