You are viewing limited content. For full access, please sign in.

Discussion

Discussion

Forms formula to display a total number of lines from a table?

posted on July 3, 2019

Is there a FX formula to display the total number of lines within a table, that is auto populated from a lookup?  The idea is to provide the end user, to be able to see the total lines generated at a quick glance.

0 0
replied on October 14, 2024 Show version history

Steve, the max(table.rowid) is fine to count rows but is there a way to countif? eg. table.variable=blah in two of three rows. countif(table.variable,"=blah") would return 2? i've tried that and the help shows the example of an array [2,2,1] countif "=2" (actually they show > 1 now i think of it). I can't get it.  The requirement is for an attribute in the table to select a value in the row, i need the count of rows if value = some text or a number.

1 0
replied on November 8, 2022

Hi Shan

Add a new Number Field to your Table called ROWID. In that field put the Formula =ROW()

If you preview the Table you will see that this field will have the number of each ROW for each line of the table.

Then in a field outside the table (ie: Number of Rows in Table), put the formula =MAX(tablename.ROWID)

You can Hide this field by a rule if you choose

 

1 0
replied on November 8, 2022

Hi Steve, 

Thanks for the post. I have tried myself however what am I missing here? I have the table populating from a lookup, and a user can add new rows. But the formula doesn't seem to work at all.

 

Any pointers apprecaited!

help.JPG
help.JPG (69.79 KB)
0 0
replied on July 4, 2019 Show version history

Hi Tom

The easiest way is if you can perform a COUNTIF on one of the Table Row variables that always contains a value. Using a field outside the table, it could look like =COUNT(Table.variable)  or =COUNTIF(Table.variable,">0")

Beyond that, you would need to use Javascript, there are a couple examples such as this in answers

https://answers.laserfiche.com/questions/116014/How-to-count-the-number-of-rows-in-a-table#143459

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.