How to retrieve number of items in the current list?
Last Update: December 12, 2017
Here are the steps on how to retrieve the number of items in the current list and save the result into a Textbox:
- Open your list in
design mode.
- Add a textbox control to the form design workspace and name it txtItemsCount.
- Select the Form by clicking on any empty space on the form design workspace area.
- In the
Rules pane, click on the Add icon to add a new rule, the
Rule Manager dialog will open.

- Add a new rule as follows:
A. Update the
Rule Name as desired.
B. Change the
Rule Type to Action.
C. Keep the
Event Type onLoad.
D. In the
Action section, type the following script:
var Items_array = (getCurrentListFieldData('ID',""));
setValue(txtItemsCount,Items_array.length);
E. Click on the
Save button to save the rule.
Note: You can use
Assistance Panel to help you adding functions and related parameters, form variables and form controls to
Conditions and/or
Actions sections. - Test the form by clicking on the
Preview button in the
View Group.