注意:
FIX
文で関数をコールするかわりに、RUNJAVA
コマンドを介してMAXL関数を使用することをお薦めします。RUNJAVA
コマンドはスクリプト・コンポーネントでのみ使用できます。
表8-12 MaxL関数
関数 | 目的 | 構文 |
---|---|---|
@CalcMgrExecuteEncryptMaxLFile |
Oracle EssbaseからアクセスできるMaxLスクリプト・ファイルを使用して、MaxLスクリプトを実行します。 |
|
@CalcMgrExecuteMaxLScript |
MaxLスクリプトを計算スクリプト自体に埋め込みます。 |
|
MaxLの暗号化を使用するには:
essmsh
を使用して公開鍵と秘密鍵を生成します。コマンドessmsh –gk
を実行すると、コンソール上で秘密鍵および公開鍵が生成されます: 暗号化用の公開鍵: 25159,850102129; 復号化用の秘密鍵: 240764119,850102129。essmsh -ep admin 25159,850102129
を使用して暗号化されたトークンを生成します。 906388712099924604712352658511のようなトークンが生成されます。
$key $1 $key $2
on localhost;で使用しますessmsh
を起動し、スクリプトessmsh -D
を実行します。 例: essmsh C:/Temp/maxlcmd1.mxls 240764119, 850102129 906388712099924604712352658511 0893542980829559883146306518502837293210
@CalcMgrExecuteEncryptMaxLFile
を使用したMaxLスクリプト・ファイルの実行@CalcMgrExecuteEncryptMaxLFileの構文は、次のとおりです:
FIX ("Sales","100-10","New York","Actual") "Jan"( @CalcMgrExecuteEncryptMaxLFile("2115028571,2505324337","C:/Temp/exportdata.mxls", @List("906388712099924604712352658511","0893542980829559883146306518502837293210"), "true"); ENDFIX
最初の引数は秘密鍵、2番目の引数はMaxLスクリプト・ファイル、3番目の引数はスクリプトの引数です。最後の引数は、これを非同期に実行するかどうかを示します("true"は非同期を示し、"false"は同期を示します)。
この方法にはいくつかの問題があります。最初の問題は、同じスクリプトを実行する必要がある回数です。このスクリプトは、FIX文のすべてのメンバーの組合せに対して実行されます。2番目の問題は、FIX文のメンバーの組合せに対してブロックが存在しないとEssbaseが判断した場合にスクリプトが一切実行されない可能性があることです。
通常、MaxLスクリプトを実行するのは1回のみであり、RUNJAVAコマンドを使用します:
RUNJAVA com.hyperion.calcmgr.common.cdf.MaxLFunctions <LOG FILE> OPTIONAL ex., "logfile=c:/Temp/maxlrule.log" The path should be accessible from the ESSBASE process. <ASYNCH FLAG> OPTIONAL ex., "true" This means calc engine does not wait for the completion of the MaxL script. The default is " false" <ALL OTHER PARAMETERS YOU PASS TO ESSMSH>
例:
RUNJAVA com.hyperion.calcmgr.common.cdf.MaxLFunctions "logfile=c:/Temp/maxlrule.log" "-D" "c:\\Temp\\maxl.msh" "28567271,1186612387" "893848844082678214004255849650" "4647275840619320283077900267208176084380" "{varAppName}";
@CalcMgrExecuteMaxLScript
を使用したMaxLスクリプトの実行@CalcMgrExecuteMaxLScriptの構文は、次のとおりです:
RUNJAVA com.hyperion.calcmgr.common.cdf.MaxLScriptFunction <LOG FILE> OPTIONAL ex., "logfile=c:/Temp/maxlrule.log" The path should be accessible from the ESSBASE process <ASYNCH FLAG> OPTIONAL ex., “true” This means calc engine will not wait for the completion of the maxl script. "mdx=true"OPTIONAL The variables are replaced with MDX syntax. This applies only to variables within the Crossjoin sections. "-D" if using encryption "<PRIVATE KEY>" if using encryption <SCRIPT LINE> <SCRIPT LINE> <SCRIPT LINE> ... <ALL OTHER PARAMETERS YOU PASS TO ESSMSH> Example 1:Using @CalcMgrExecuteMaxLScript: RUNJAVA com.hyperion.calcmgr.common.cdf.MaxLScriptFunction "-D" "28567271,1186612387" "spool on to 'C:\\ALC\\out.log'" "login $key 893848844082678214004255849650 $key 4647275840619320283077900267208176084380 on localhost" "alter database 'SampleASO'.'Basic' clear data in region 'Crossjoin(Descendants([TotalPV],Province.Levels(0)),Crossjoin(Descendants([TotalLOB],LOB.Levels(0)), Crossjoin(Descendants([TotalActivity],Activity.Levels(0)),Crossjoin(Descendants([TotalBrand],Brand.Levels(0)), Crossjoin(Descendants([BS000],Account.Levels(0)),Crossjoin({[FY14]},Crossjoin({[Working]},Crossjoin({[Apr]},{[Actual]}))))))))' physical" "logout" "spool off" "exit" What if the script is not fixed but based on a runtime prompt or an argument to MaxL? If you use a runtime prompt within quoted text, Planning does not replace it. If you use $1 within quoted text in MaxL, Planning does not replace it. In the example below, you use a runtime prompt instead of hardcoding it to "Working". You can rewrite the script using a runtime prompt and a MaxL argument holder. Example 2 Using a Runtime Prompt Variable and a MaxL Argument Holder RUNJAVA com.hyperion.calcmgr.common.cdf.MaxLScriptFunction "-D" "28567271,1186612387" "spool on to 'C:\\ALC\\out.log'" "login $key 893848844082678214004255849650 $key 4647275840619320283077900267208176084380 on localhost" "alter database 'SampleASO'.'Basic' clear data in region 'Crossjoin(Descendants([TotalPV],Province.Levels(0)),Crossjoin(Descendants([TotalLOB],LOB.Levels(0)), Crossjoin(Descendants([TotalActivity],Activity.Levels(0)),Crossjoin(Descendants([TotalBrand],Brand.Levels(0)), Crossjoin(Descendants([BS000],Account.Levels(0)),Crossjoin({[FY14]},Crossjoin({[$1]},Crossjoin({[Apr]},{[Actual]}))))))))' physical" "logout" "spool off" "exit" {WhatVersion} Where {WhatVersion} is a runtime prompt variable. Anything after the "exit" in the preceding example is considered an argument to the script. The custom defined function will replace $1, $2..$n in the script based on the number of arguments. Example 3 Using MaxL=True RUNJAVA com.hyperion.calcmgr.common.cdf.MaxLScriptFunction ......"mdx=true" ......"-D" ......"28567271,1186612387" ......"spool on to '/tmp/Essbase_ClearAndLoadStandardFX.log'" ......"login $key 893848844082678214004255849650 $key 4647275840619320283077900267208176084380 on localhost" ......"alter database glblaso.aso clear data in region ' CrossJoin( {$1} , { ( $2 , [Actual] , $3 , [USD] )} )' physical " ......"import database 'GlblASO'.'ASO' data from server text data_file '../../StdFxExport.txt' using server rules_file 'LdASO' on ......error write to './tmp/EssbaseLoadASOStdFX_errors.log' " "logout" "spool off" "exit" "LE_83901,LE_83911" "Jan" "2014" Results in script: spool on to '/tmp/Essbase_ClearAndLoadStandardFX.log'; login $key 893848844082678214004255849650 $key 4647275840619320283077900267208176084380 on localhost; alter database glblaso.aso clear data in region ' CrossJoin([LE_83901], [LE_83911] , { ( [Jan] , [Actual] , [2014] , [USD] )} )' physical ; import database 'GlblASO'.'ASO' data from server text data_file '../../StdFxExport.txt' using server rules_file 'LdASO' on error write to './tmp/EssbaseLoadASOStdFX_errors.log' ; logout; spool off; exit; NOTE: MDX=true is optional. Using MDX=true replaces the variables with MDX syntax in the Crossjoin sections. Example 4: Using a List of Functions with Double Quotes and Semicolons I wanted to execute the following calc via CDF: RUNJAVA com.hyperion.calcmgr.common.cdf.MaxLScriptFunction "spool on to 'c:/tmp/calc.log'" "login admin password on localhost" "execute calculation ' SET CREATEBLOCKONEQ ON; SET AGGMISSG ON; FIX (@IDESCENDANTS("BS"),"Plan") DATACOPY "Working" to "Target"; ENDFIX FIX ("Plan","Target") CALC DIM ("Account","Period","Entity","Product"); ENDFIX' on Vision.Plan1" "logout" "spool off" "exit" ; But Essbase does not interpret the " and the ; correctly in the strings. To work around this, replace all of the " with "& and all of the ; with &scolon& as follows: RUNJAVA com.hyperion.calcmgr.common.cdf.MaxLScriptFunction "logfile=c:/Temp/maxl.log" "spool on to 'c:/tmp/calc.log'" "login admin password on localhost" "execute calculation ' SET CREATEBLOCKONEQ ON&scolon& SET AGGMISSG ON&scolon& FIX (@IDESCENDANTS("&BS"&),"&Plan"&) DATACOPY "&Working"& to $quot&Target"&&scolon& ENDFIX FIX ("&Plan"&,"&Target"&) CALC DIM ("&Account"&,"&Period"&,"&Entity"&,"&Product"&)&scolon& ENDFIX' on Vision.Plan1" "logout" "spool off" "exit" ; This revised script generates the following: essmsh C:\Users\SRMENON\AppData\Local\Temp\2\calc8153268024796650753.mxl Essbase MaxL Shell 64-bit - Release 11.1.2 (ESB11.1.2.4.000B154) Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. MAXL> login admin password on localhost; "" OK/INFO - 1051034 - Logging in user [admin@Native Directory]. OK/INFO - 1241001 - Logged in to Essbase. MAXL> execute calculation ' 2> SET CREATEBLOCKONEQ ON; 3> SET AGGMISSG ON; 4> FIX (@IDESCENDANTS("BS"),"Plan") 5> DATACOPY "Working" to "Target"; 6> ENDFIX 7> 8> FIX ("Plan","Target") 9> CALC DIM ("Account","Period","Entity","Product"); 10> ENDFIX' 11> on Vision.Plan1; OK/INFO - 1012553 - Copying data from [Working] to [Target] with fixed members [Account(1110, 1150, 1100, 1210, 1220, 1260, 1200, 1310, 1332, 1340, 1300, 1410, 1460, 1 471, 1400, 1010, 1510, 1520, 1530, 1540, 1550, 1560, 1565, 1570, 1580, 1500, 1610, 1620, 1630, 1640, 1650, ]. OK/INFO - 1012675 - Commit Blocks Interval for the calculation is [3000]. OK/INFO - 1012675 - Commit Blocks Interval for the calculation is [3000]. OK/INFO - 1012574 - Datacopy command copied [0] source data blocks to [0] target data blocks. OK/INFO - 1012675 - Commit Blocks Interval for the calculation is [3000]. OK/INFO - 1012714 - Regular member [Sales Calls] depends on dynamic-calc member [Rolling].. OK/INFO - 1012714 - Regular member [Sales Calls] depends on dynamic-calc member [YearTotal].. OK/INFO - 1012714 - Regular member [Period] depends on dynamic-calc member [YearTotal].. OK/INFO - 1012684 - Multiple bitmap mode calculator cache memory usage has a limit of [5] bitmaps.. OK/INFO - 1012668 - Calculating [ Account(All members) Period(All members) Entity(All members) Product(All members)] with fixed members [Scenario(Plan); Version(Target)]. OK/INFO - 1012677 - Calculating in serial. OK/INFO - 1012550 - Total Calc Elapsed Time : [0.002] seconds. OK/INFO - 1013274 - Calculation executed. MAXL> logout; User admin is logged out MaxL Shell completed