Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

counting rows

Hello,

newbie question. I try to count the selected entries of a table. I have a script

LOAD * INLINE [
F1,F2
A,1
B,2
B,3
C,4
C,5
C,6
];

And there's a table box with F1 and F2. Now I want to have another table box to show the number of rows in the first table. The result should be 6 for no selection, 1 for A selected, 2 for B and 3 for C. I know there are count functions but I don't know how to apply them because I don't know how to refer a table.

Can you please help me? Thank you.

Stefan

1 Solution

Accepted Solutions
kji
Employee
Employee

Straight table (form of chart) is probably what you are looking for.

View solution in original post

12 Replies
martin59
Specialist II
Specialist II

Hi,

If I were you, I would count the selected entries into my application, but not in script.

To do that, you have to create a chart with F1 as dimension, and the following expression :

Count(Distinct F2)




Not applicable
Author

Thank you very much. Not quite what I was looking for, but you showed me the way to count in the application. I'm a little more familiar with the object dialog windows now.

Not applicable
Author

If you want to show only the count, you can also create a text object with expression '=count(F1)' and display the result.

Not applicable
Author

Not bad. I also tried a statistics box which brings the best result so far because it has the right size and contains a text plus the count.

What would be best is a table box containing only one row with two columns. The left cell has a text constant, the right box has the count. But I don't see a way to put a formula into a table cell. Any idea?

kji
Employee
Employee

Straight table (form of chart) is probably what you are looking for.

Not applicable
Author

Do you know the Presidents demo? In the tab "Presidents" there is a table on the left titles "Party". What kind of object is it and how did they manage to show the number of each party for the present selection?

orlando
Partner - Contributor
Partner - Contributor

Perhpaps this helps:

//Text Box with:

=If(IsNull(GetFieldselections(F1)),'No. of F1 values',GetFieldselections(F1)) & ': ' &count( F1)



Not applicable
Author

Definitely a cool piece of code. It's just not table style.

Not applicable
Author

I'd like to have a table with two columns

F1 -> count(F1)

Selecting A would result in a table

A | 1

Selecting B and C results in

B | 2

C | 3

I think the Presidents demo does the trick with the statistics box but I'm not sure.