這個函數會使用係數 POV 作為配置的基礎,將來源檢視點 (POV) 配置到目標 POV,並含有選項可將總計配置金額反向登入至排除 POV。這個函數是專為自訂維度配置所設計。
傳回值
無傳回值。
語法
Custom_Alloc(Destination,Source,Factor,FactorN,FactorD,
Elimination)
表格 12-18 Custom_Alloc 函數的語法
參數 | 有效值 |
---|---|
Destination |
有效的目標 POV,是 Account、ICP 和 Custom 1-4 成員的有效組合。 |
Source |
有效的來源 POV,是維度成員的有效組合。Source 是要配置的金額。 |
Factor |
有效的來源 POV。Factor 是用來儲存配置係數的帳戶。 |
FactorN |
有效的來源 POV。FactorN 是用來作為配置基礎的分子係數。 |
FactorD |
有效的來源 POV。FactorD 是用來作為配置基礎的分母係數。 |
Elimination |
有效的來源 POV。Elimination 可以是空白的字串 ("");在這種情況下,會忽略此參數。如果已設定 Elimination 參數清單,記入至目標 POV 的金額會乘以 -1,並記入排除 POV。 |
詳細說明
這個函數會使用係數 POV 作為配置的基礎,將來源 POV 配置到目標 POV,並含有選項可將總計配置金額反向登入至排除 POV。這個函數是專為自訂維度配置所設計。
Factor 參數會儲存 FactorN 除以 FactorD 的結果。需要這個結果,係數才能參照目前實體以外的實體。
如果來源 POV 中的實體是父項,則該父項必須整合,才能在子項層級執行計算。如果父項幣別和子項幣別不同,則也必須執行所有相關幣別的轉換,才能在子項層級執行計算。
建議在呼叫常式中設定變數,並將其傳遞至 Custom_Alloc 函數,這些變數會定義目標、來源、係數、FactorN、FactorD 和排除 POV。建議將呼叫常式中的變數名稱設定為與 Custom_Alloc 函數相同。
Elimination 參數可以是空白的字串 ("");在這種情況下,會忽略此參數。如果已設定 Elimination 參數,登入至目標 POV 的金額就會乘以 -1,並登入至排除 POV。
範例
Telephone 帳戶會依據產品銷售對銷售總計的比率配置給 Products。配置金額的反向運算子會登入至 Allocations 帳戶。
表格 12-19 Custom_Alloc 函數的範例
科目 | Jan2014 | Feb2014 | Mar2014 |
---|---|---|---|
A#Telephone.C1#[None] |
100 |
300 |
400 |
A#Sales.C1#Product1 |
1000 |
1000 |
1000 |
A#Sales.C1#Product2 |
1000 |
2000 |
3000 |
A#Sales.C1#TotalProducts |
2000 |
3000 |
4000 |
Custom_Alloc |
N/A |
N/A |
N/A |
A#Factor.C1#Product1 |
0.50 |
0.33 |
0.25 |
A#Factor.C1#Product2 |
0.50 |
0.66 |
0.75 |
A#Telephone.C1#Product1 |
50 |
100 |
100 |
A#Telephone.C1#Product2 |
50 |
200 |
300 |
A#ProductAllocations.C1#[None] |
-100 |
-300 |
-400 |
從 CUSTOM_ALLOC 函數傳回的結果如下:
HS.EXP "A#Factor = A#Sales / A#Sales.C1#TotalProducts"
HS.EXP "A#Telephone = A#Telephone.C1#[None] * A#Factor"
HS.EXP "A#Allocations.C1#[None] = (A#Telephone.C1#[None] * -1)"
範例指令碼
這個指令碼包含下列資訊:
在呼叫常式中寫入的範例陳述式。
在呼叫常式中設定並傳遞至 Custom_Alloc 函數的變數。
呼叫常式中的變數名稱,設定為與 Custom_Alloc 函數相同。
Sub Calculate()
Dim Destination Dim Source Dim Elimination Dim Factor Dim FactorN Dim FactorD Dim C1list Dim C1item
C1list = HS.Custom1.List("Alloc")
For Each C1item in C1list
Source = "A#Telephone.C1#[None]" Destination = "A#Telephone.C1#" & C1item Factor = "A#Factor.C1#" & C1item FactorN = "A#Sales.C1#" & C1item FactorD = "A#Sales.C1#TotalProducts" Elimination = "A#ProductAllocations.C1#" & C1item
Call Custom_Alloc(Destination,Source,Factor,FactorN, FactorD,Elimination)
Next
End Sub
' Beginning of the Custom_Alloc function
Sub Custom_Alloc(Destination,Source,FactorN,FactorD, Elimination)
HS.Clear Factor
HS.Exp Factor & " = " & FactorN & "/" & FactorD
HS.EXP Destination & " = " & Source & " * " & Factor
If Elimination <> "" Then
HS.EXP Elimination & " = " & Source & " * -1 * " & Factor
End If
End Sub