SetCells2

Sets data for an array of cells and returns the cells’ statuses; if any of the cells are not writable, SetCells2 inserts data in the writable cells. For each cell in the array, you can either insert data or set the cell to Null.

SetCells2 takes arrays of dimension member IDs as arguments, as well as an array of data for the cells to be set. These arrays must contain identical numbers of elements. The elements of the member ID arrays have a one-to-one correspondence to the elements of the data array.

Syntax

<HsvData>.SetCells2 varalScenario, varalYear, varalPeriod, varalView, varalEntity, varalParent, varalValue, varalAccount, varalICP, varalCustom1, varalCustom2, varalCustom3, varalCustom4, varadData, varabIsNoData, pvaralStatus

Argument

Description

varalScenario

Long array (ByVal). The member IDs of the cells' Scenario dimension members.

varalYear

Long array (ByVal). The member IDs of the cells' Year dimension members.

varalPeriod

Long array (ByVal). The member IDs of the cells' Period dimension members.

varalView

Long array (ByVal). The member IDs of the cells' View dimension members.

varalEntity

Long array (ByVal). The member IDs of the cells' Entity dimension members.

varalParent

Long array (ByVal). The member IDs of the parents of the varalEntity argument's entities.

varalValue

Long array (ByVal). The member IDs of the cells' Value dimension members.

varalAccount

Long array (ByVal). The member IDs of the cells' Account dimension members.

varalICP

Long array (ByVal). The member IDs of the cells' Intercompany Partner dimension members.

varalCustom1

Long array (ByVal). The member IDs of the cells' Custom 1 dimension members.

varalCustom2

Long array (ByVal). The member IDs of the cells' Custom 2 dimension members.

varalCustom3

Long array (ByVal). The member IDs of the cells' Custom 3 dimension members.

varalCustom4

Long array (ByVal). The member IDs of the cells' Custom 4 dimension members.

varadData

Double array (ByVal). The data to be inserted in the cells. The elements in this array correspond to the elements in the other arguments. For example, the fifth element in this array is inserted in the cell defined by the member IDs in the fifth elements of the other arguments’ arrays.

varabIsNoData

Boolean array (ByVal). Determines whether the corresponding element in the varadData argument’s array is inserted or the cell is set to Null. Pass FALSE to insert data, TRUE to set a cell to Null.

You might find it useful to conditionally pass TRUE in cases where a varadData element is 0 (zero).

Passing TRUE deletes any existing data in a cell.

pvaralStatus

Variant array. Returns the cells’ statuses. For details on cell statuses, see About Cell Statuses.

The array items are returned as a Long subtype.

Example

The following function inserts data into cells; if 0 is passed for a cell’s data, the cell is set to Null. The cells’ dimension members and data are passed in the subroutine’s arguments. The subroutine constructs the array passed to the varabIsNoData argument of SetCells2; if 0 is passed for a cell’s data, the corresponding item in the baNull array is set to TRUE.

Function setCells2OrNull(laScen() As Long, laYear() As _
    Long, laPer() As Long, laView() As Long, laEnt() As Long, _
    laPar() As Long, laVal() As Long, laAcct() As Long, laICP() _
    As Long, laCust1() As Long, laCust2() As Long, laCust3() _
    As Long, laCust4() As Long, daData() As Double) As Variant
Dim cData As HsvData, baNull() As Boolean, vaRet
'g_cSession is an HsvSession object reference
Set cData = g_cSession.Data
'Build the baNull array
ReDim baNull(UBound(daData))
For i = LBound(daData) To UBound(daData)
    If daData(i) = 0 Then
        baNull(i) = True
    Else
        baNull(i) = False
    End If
Next i
cData.SetCells2 laScen, laYear, laPer, laView, laEnt, _
    laPar, laVal, laAcct, laICP, laCust1, laCust2, laCust3, _
    laCust4, daData, baNull, vaRet
setCells2OrNull = vaRet
End Function