Symptom
The performance of the API Table.getRowCount() is slow, it takes about 60s to return a result for a table with approx. 50000 records and 25 columns. "Auto-Size and Page Table Vertically" is enabled and the drill limitation is set to 50000 or Unlimited.
Environment
SAP Analytics Cloud
Reproducing the Issue
Run script Table.getRowCount()
Cause
The API getRowCount() is designed to load the entire result set (50000 rows * 25 cols) from backend side to front side for counting the rows, so more rows and columns will take more time.
Resolution
1. Change the drill limitation to a smaller value or add dimension filter to decrease the size of the result set. Please note that the API getRowCount() will also be limited with this option. For example, when your set rows = 500, the return vaule of getRowCount() will not be larger than 500.
2. Create a copy(Table_2) of the main table:
- Table_2 is linked to the main table via Linked Analysis.
- Table_2 is only used for getRowCount() and has only one dimension in Rows.
Please note that Table_2 cannot be hidden due to a known limitation, you can move Table_2 to the back of a widget as a workaround.
When Auto-Size and Page Table Vertically is enabled, all the widgets on the page become visible, whether they are set to hidden at design time or via scripting.
Keywords
SAC, getRowCount, table, performance , KBA , LOD-ANA-AD , Analytics Designer , LOD-ANA-UNS-SCR , Unified Story Scripting related Issues , Problem