Sets a cell’s data; you can either insert data or set the cell to Null.
Tip: | SetCell passes the data to be inserted as a Double. To insert a cell’s data by passing a String, use SetTextCell. |
Syntax
<HsvData>.SetCell(lScenario, lYear, lPeriod, lView, lEntity, lParent, lValue, lAccount, lICP, lCustom1, lCustom2, lCustom3, lCustom4, dData, bIsNoData)
Argument | Description |
---|
lScenario | Long (ByVal). The member ID of the cell's Scenario dimension member. |
lYear | Long (ByVal). The member ID of the cell's Year dimension member. |
lPeriod | Long (ByVal). The member ID of the cell's Period dimension member. |
lView | Long (ByVal). The member ID of the cell's View dimension member. |
lEntity | Long (ByVal). The member ID of the cell's Entity dimension member. |
lParent | Long (ByVal). The member ID of the parent of the lEntity argument's entity. |
lValue | Long (ByVal). The member ID of the cell's Value dimension member. |
lAccount | Long (ByVal). The member ID of the cell's Account dimension member. |
lICP | Long (ByVal). The member ID of the cell's Intercompany Partner dimension member. |
lCustom1 | Long (ByVal). The member ID of the cell's Custom 1 dimension member. |
lCustom2 | Long (ByVal). The member ID of the cell's Custom 2 dimension member. |
lCustom3 | Long (ByVal). The member ID of the cell's Custom 3 dimension member. |
lCustom4 | Long (ByVal). The member ID of the cell's Custom 4 dimension member. |
dData | Double (ByVal). The data to be inserted in the cell. |
bIsNoData | Double (ByVal). Determines whether the dData argument’s data is inserted or the cell is set to Null. Pass FALSE to insert data, TRUE to set the cell to Null. You might find it useful to conditionally pass TRUE in cases where the dData argument’s amount is 0 (zero). Caution! Passing TRUE will delete any existing data in the cell. |
Return Value
Integer. Indicates the success of the function call; returns 0 for success or an error code for failure.
Example
The following subroutine inserts data into a cell; if 0 is passed as the cell data, the cell is set to Null. The cell’s dimension members and data are specified by the subroutine’s arguments.
Sub setCellDataOrNull(lScen As Long, lYear As Long, lPer As _
Long, lView As Long, lEnt As Long, lPar As Long, lVal As _
Long, lAcct As Long, lICP As Long, lCust1 As Long, _
lCust2 As Long, lCust3 As Long, lCust4 As Long, _
dData As Double)
Dim cData As HsvData
'g_cSession is an HsvSession object reference
Set cData = g_cSession.Data
If dData = 0 Then
cData.SetCell lScen, lYear, lPer, lView, lEnt, lPar, _
lVal, lAcct, lICP, lCust1, lCust2, lCust3, lCust4, _
dData, True
Else
cData.SetCell lScen, lYear, lPer, lView, lEnt, lPar, _
lVal, lAcct, lICP, lCust1, lCust2, lCust3, lCust4, _
dData, False
End If
End Sub