fncCrtTblRows
Beyond Excel's (BXL's) Function:
Create a Table of n Rows
Name: fncCrtTblRows()
Use:
Create dynamic tables.
Description:
Creates a single column table of n rows that when loaded to Excel and formulas attached can dynamically set the table's size by changing the row parameter.
Parameters
This function has two parameters: RowCount and ColumnName. RowCount is how many rows to create in the table. ColumnName is the heading that will be applied to the table's only column.
Example:
let
RowCount = fncGetNameValue("Periods"),
DynTbl = fncCrtTblRows(RowCount, "Prd")
in
DynTbl
Code:
/* Description:Create a table with <RowCount> rows in a column named <ColumnName>
Requisites: *None
Inputs: RowCount: Number of rows for table
ColumnName: Name of column to hold row #
Outputs: Lst2Tbl: A table with 1 column and RowCount rows
Date Ini Description
04/04/18 CWH Original Development
*/
(RowCount as number, ColumnName as text) =>
let
/* Generate a list of values from 1 to the number indicated in named object */
CrtLst = List.Generate(()=>1, each _ <= RowCount, each _ +1),
/* Convert list to a 1 column table and name the column <ColumnName> */
Lst2Tbl = Table.FromList(CrtLst, Splitter.SplitByNothing(), {ColumnName})
in
Lst2Tbl