How can I find the number of records inserted into a spreadsheet using Report.AddTable ?
On one sheet I have imported my data from a TList<T>. I now want to get the sum of one of the columns.
Lets say I imported 85 rows of data going from row 2 in the spreadsheet to row to row 86. I now want the sum of column B from row 2 to row 86.
I could use the Excel function =Sum(B:B) but this will sum the entire column, not just the imported data.
I can get the address of the first cell where I want the sum to start (B2) but I can't get the address of the last cell (B86). If I knew the number or rows inserted then this would be possible.
But I think this would be overdoing it. Just writing the formula in a way it will expand should be enough. (=SUM(B2:B2) won't expand, you need at least 2 rows like B2:B3)
Thanks for your quick reply. This leads me to another question.
I want to use DSUM and DCOUNT Excel functions. Both of these require a range to be defined in which the first row will contain the column names and subsequent rows contain the data.
I have my column names in row 1 and my data starts in row 2. I have defined a range Arrears as B1:B10 and my data inserts as expected.
I now need a range starting on row 1 and ending on my last row of data. How can I set this up ? Do I need to use <#sometable.#RowCount> or is there a better way to do it ?
Honestly I don't think I can recall a case where you need to use #RowCount to manually create formulas. #RowCount can have other uses (like for example deleting the row if row count is 0, or doing something with the first 5 rows, etc) but formulas normally don't need anything. I actually don't recall needing the <#formula> tag in any real report either.
I am not really sure on how exactly your data looks like, but it is normally always the same: Define a range with at least 2 rows so it expands, and end the name with an "X" so the empty extra row is deleted after the report runs.
I've uploaded a simple example using DSum which recreates the example here:
As said, I don't think there is a need to manually create a formula here, but if your case is different, can you modify this template to show what the problem would be?
I want to use the Excel function DSUM. The first parameter of DSUM is an excel database. This is a range where the first row contains column names and subsequent rows contain data.
In my FlexCel report how do I define a range where the first row contains column names and the subsequent rows contain data.
Given the following
A B 1 Name Count 2 <#Table.Name> <#Table.Count>
If I set Data as A2:B2 then Data does not contain column names and I can't use DSUM. If I set Data as A1:B2 then the column name row is repeated for every row of data imported and I can use DSUM. How should I define Data so that the first row contains column names and subsequent rows contain data so I can use DSUM ?