Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I want to find the number of rows in a table, and pass that value to another program via a QV variable.
I tried (in my script)
LET vNumRows=NoOfRows('Daily CAR Table') <-- I also tried 'CH12', "CH12", "Daily CAR Table", but always got NULL
but that returns NULL.
The only other way I could see to do it would be to create a macro using table.GetRowCount, but then Henric might be upset with me ;}.
Any thoughts?
Thanks,
Kevin
It works for me....
in load script:
let vRows = NoOfRows('RESULT');
in textbox :
=$(vRows)
Write like this way
LET vNoofrows = NoOfRows('TableName');
Or
LET vNoofrows = NoOfRows('New Table');
For your Eg
LET vNumRows=NoOfRows('Daily CAR Table')
Note:- but confirm you give table name like this way [Daily CAR Table] or "Daily CAR Table"
Hi,
Are you trying to get the number of rows from logical table?
So then you have to do it in load script, not in presentation objects.
if you are looking to get the number of rows from the charts then
Macro is the option to the number of rows from the chart. Please refer APIguide for that.
Thanks Anand, but this is what's driving me crazy.. I think I have exactly what you are suggesting!!
I thought at first that maybe the spaces in the table name were causing the problem, so I renamed it "CARTable".
In my script:
LET vNumRows = NoOfRows('CARTable');
In my text box:
='Number of rows is '&$(vNumRows)
Always NULL.
Questions:
1 - I always put my variable declarations at the top of my script, right after the standard "SET DateFormat" etc. block.
Should this LET statement go there, elsewhere, or it doesn't matter?
2 - When you refer to 'table name', do you mean the "Window Title" on the "Properties"->"General" tab, or something else?
3 - Not sure what you mean in your last sentence.. do you mean in my chart properties, the name should be entered as [CARTable], and not just CARTable?
Could you please explain the term 'logical table'?
I am trying to count the number of rows in a pivot table. If it is less than 2, I don't want to print the table, so I want to pass the number of rows to a 3rd party printing program. so that it can evaluate the condition "if vNumRows <=2, don't print".
1. I think you have to put the variable definition after the definition of the table of which you want to count the rows. otherwise that table kind of points to a null value and therefore contains no rows...
Looking at your original post you're trying to find the rows of a straight or pivot table ( I also tried 'CH12', "CH12",)
The answers here are for tables loaded into the data model which won't work with what you're trying to do. For that you will need to use a macro (APIguide) .
Richard
QlikCentral.com
Don't tell Henric! :}
ARGHH.. Just to be quick, I hardcoded the table ID...
FUNCTION TableRC
SET table = ActiveDocument.GetSheetObject("CH03")
TableRC = table.GetRowCount
END FUNCTION
Returns NULL, while I'm looking at the table with its 27 rows.
This is copied almost word-for-word from the API Guide.
Help, please?