Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Showing a table row count in a text object

Hey there!

i have a chart table "A"  and i want to show the number of rows in table A in a separate text object.

Can I do that?

Thanks!

Mor

8 Replies
giakoum
Partner - Master II
Partner - Master II

=count(some_table_field)

or

=count({1} some_table_field)

(disregarding selections)

MK_QSL
MVP
MVP

add one more line in script while loading table

RowNO() as NO

Now use

COUNT(NO)

or

Max(NO)

in text box

senarath
Creator III
Creator III

H,

it is possible and refer the screen shot.Here I have selected a Dim and a expression. Also do note the Total mode that I have showed.You can also hide Dim column if you do not want to show alist under presentation.

rowcount.jpg

thanx

sathishkumar_go
Partner - Specialist
Partner - Specialist

Hi,

You can use count function.

Like count(Field), Here Field -> you have to use any dimensional field in that chart.

or u can use macro also

SUB ReadRowsCount
set v = ActiveDocument.GetVariable("Variable")
v.SetContent ActiveDocument.GetSheetObject( "ChartId" ).GetRowCount-1, true
end SUB

-Sathish

Not applicable
Author

Hey!

Thanks for your advices, but i don't want to count the rows in a table that i load into Qlikview, i want to count the rows in a table chart i have in my dashboard.

Sathish - i don't understand what i need to do with your macro, what should i write in the text object what will show there the table row count?

ashfaq_haseeb
Champion III
Champion III

Hi you can even use this macro

Sub CountRow

set chart = ActiveDocument.GetSheetObject("CH01")

'msgbox("number of class members = "&chart.GetNoOfRows)

set v = ActiveDocument.Variables("RowsNum")

v.SetContent chart.GetNoOfRows,true

End Sub

sathishkumar_go
Partner - Specialist
Partner - Specialist

Hi Mor,

use count(Dimensionfield in the table) in the text object this will give the no of rows.

Or you can use the macro which i have mentioned in the above one. That macro also finds the no of rows in the particular table. After running the macro pass the "Variable" in the text box.

Regards

Sathish

giakoum
Partner - Master II
Partner - Master II

Don't use macros for tasks like that, it is a major performance risk.

You need to replicate your table in the text box by using the aggr function. For example, if in your table dimension is DimA and expression is sum(value) then in the text box you need the following :

=RangeCount(aggr(sum(value), DimA))

Sometimes the count of rows is different that the count the expression returns based on certain criteria. Try it though, it may work for you.