Returns the number of objects in the specified collection. Read-only.
object.Count = [integer]
Where object is an object expression that evaluates to one of the controls in the Applies To list, and integer is the number of objects in the collection.
Newlook Smartclient
Newlook Server
The Count property can be useful for determining how many items exist in a specific collection.
The count property is used to return the number of columns in a ListView control's Column Header collection.
Used to return the total number of identified columns in the datagrid.
There are some additional things to consider when using this property with a DataGrid's Columns collection.
When a data grid control is generated from an IBM i subfile,
there is often a difference between the total number columns that the recognition engine "identifies" in the grid (which is returned by the <datagridControl>.Columns.Count
property), and the total number of columns that are displayed at runtime. This is because IBM i subfiles often contain columns that exist only to align the contents of the subfile. The Newlook
recognition engine will automatically hide these non-data columns at runtime. The columns exist, and are included in the grid's columns count, but their Visible property defaults to False. You can check a specific column's index in Inspector or by opening the grid's Column Editor in Designer.
It is also possible for individual rows in the data grid control to contain a different
number of cells. For this reason, if the total number of cells in a specific row is
required, then it is important that you use the syntax <datagridControl>.ColCount(<RowIndex>)
. This
is particular relevant when looping through all the cells in a grid.
There may also be a difference in the number of columns returned by the Count property when the ShowColumns property is True compared to when it is False. When ShowColumns is turned on the recognition engine performs special processing to match column headings with their associated columns, even if they do not begin at the same green screen column location. The columns are adjusted so that both align. With ShowColumns set to False there is no column adjustment performed. Every time the recognition engine identifies a new cell in a row it will create a column. Headings that are not aligned will create additional columns in the Columns collection. Therefore it is not unusual to come across a subfile that will return more columns with ShowColumns turned off than it will with ShowColumns turned on.
The following JScript example returns the total number of identified rows and columns for the grid:
//Obtain maximum row and column count for the grid
var control = App.ActiveForm.MyGrid;
intGridColumnCount = control.Columns.Count;
intGridRowCount = control.RowCount;
Be aware that the syntax App.ActiveForm.Controls.Count
will return the total number of controls on the current form including any Tab pages and SmartNav groups you have on your form. Therefore a from containing one tab control with four tab pages will return a control count of 5. Hidden controls (those controls with a Visible property set to False) will also be included in this count.
Returns the number of items in the dropped files collection for the object. This represents the number of files "dragged and dropped" onto the object.
Returns the number of currently opened forms. Assigning a master form to the solution will add an item to this collection. Opening a pop-up screen will increment this value.
Returns the number of function keys identified for the active form.
The following JScript example returns the total number of function keys on the current form:
//Get the number of function keys on the current form
var form = App.ActiveForm;
intFunctionKeyCount = Form.FunctionKeys.Count;
Used to return the total number of groups in a SmartNav control.
Used to return the total number of list items in a ListView control.
Used to return the total number of nodes in a TreeView control.
Used to return the total number of tab pages in a Tab control.
Used to return the total number of transactions in the current repository (sid file).
Used to determine the number of inputs/outputs supported by a specified transaction.
The following JScript example determines the total number of inputs and outputs for the first transaction in the current repository:
//Get total number of inputs and outputs for first transactions in current .sid file
intTransactionInputs = App.Repository.Transactions(0).Inputs.Count;
intTransactionOutputs = App.Repository.Transactions(0).Outputs.Count;
ColCount property | RowCount property | ShowColumns property
Column Headers collection (ListView)
Function Keys collection (Form)
ListItems collection (ListView)
Transaction Outputs collection
© 2004-2021 looksoftware. All rights reserved.