InsertColumnArray Method

Adds a column to the Columns collection of a DataGrid and populates the cells of this column with the contents of the specified array.

DataGridObject.InsertColumnArray(ColIndex, ArrayVar, Index)

Client support

   Newlook Smartclient

   Newlook Server

Parameters

ColIndex - (Integer, Required)

An integer which specifies where the new column will be inserted. If ColIndex is 0 then the new column will be inserted as the leftmost column in the DataGrid, if ColIndex is n the new column will be inserted to the left of the nth column in the columns collection. To insert a new column as the rightmost column in the grid, the ColIndex must be equal to the total number of columns in the columns collection (as returned by object.columns.count).

ArrayVar - (Array, Required)

A variable containing a two-dimensional array of cell values. This argument can be initialized by assigning a variable to a source data grid or can be a variable array that you have manually populated.

Index - (Integer, Required)

The index of the column of values within the above array that is to be inserted into the new grid.

Use

This method was designed to provide developers with a simple method of transferring data from one host subfile to a different data grid control. It is particularly useful when you are merging data from one subfile on an IBM i screen to another grid on a different screen.

Before this method can be invoked in this scenario, it is necessary to create an override on the screen containing the grid whose contents you wish to transfer elsewhere. The contents of the grid must be assigned to a variable array, by setting the datagrid's Variable property. Once this variable is initialized it can be used in the ArrayVar argument of the method to insert the array of data values into a second DataGrid. Refer to the examples below.

It is worth noting that when you save the contents of a grid as a variable array, any hidden columns will be saved in the array, as well as any header rows.

NOTE!

Inserting a column using this method causes the index of every subsequent column and the count of the columns collection to increment by 1.

Returns

Returns a Boolean value indicating the success or failure of the action.

Applies To

DataGrid control

See Also

InsertColumn method | Variable property | InsertRow method


© 2004-2021 looksoftware. All rights reserved.