我试图在命令管理器中运行下面的脚本,我收到下面的错误消息。该脚本应该从另一个文件夹中的事实批量创建一堆指标。有人可以告诉我我错过了什么。我是在命令管理器中运行脚本的新手。
Script:
//list all metrics in the project
String sProjectName = "ProjectName";
String sFactFolder = "\Schema Objects\Facts\FolderName";
String sMetricFolder = "\Public Objects\Metrics\BulkTest";
ResultSet oFacts = executeCapture("LIST ALL FACTS IN FOLDER '" + sFactFolder + "' FOR PROJECT '" + sProjectName + "';");
oFacts.moveFirst();
while (!oFacts.isEof() )
{
//get name and path of this metric to list properties
String sFactName = oFacts.getFieldValueString(DisplayPropertyEnum.NAME);
//get properties of each metric
EXECUTE("CREATE METRIC "" + sFactName + "" IN FOLDER "" + sMetricFolder + "" EXPRESSION 'sum([" + sFactName + "])' ON PROJECT "" + sProjectName + "";");
oFacts.moveNext();
}
Errors:
Syntax error at line '2', column '4'. Expected: ADD, ALTER, APPLY, APPEND, ACTIVATE, BULKSAVEBEGINS, BULKSAVEENDS, CLEAR, CONNECT, CREATE, DEACTIVATE, DELETE, DISCONNECT, DISABLE, ENABLE, GET, GRANT, IDLE, IMPORT, INVALIDATE, KILL, LIST, LOAD, LOG, PUBLISH, PURGE, REGISTER, REMOVE, REPLACE, RESTART, RESUME, REVOKE, RUN, SEND, SET, START, STOP, TAKE OWNERSHIP, TRIGGER, UNLOAD, UNLOCK, UNREGISTER, UPDATE, VALIDATE, RESET, LOCK, EXECUTE, EXPIRE
Task(s) execution completed with errors.
Execution Time: 00:00:00
答案 0 :(得分:0)
如果您在命令管理器中直接运行它,它将失败,因为它是Java。您需要使用该代码创建一个过程,并从命令管理器调用该过程。文档应该涵盖我认为的过程。
答案 1 :(得分:0)
使用过程并键入(不粘贴代码)代码。 另外,更改执行命令如下。
EXECUTE("CREATE METRIC '" + sFactName +
"' IN FOLDER '" + sMetricFolder +
"' EXPRESSION 'sum([" + sFactName + "])' ON PROJECT '" + sProjectName + "';");
oFacts.moveNext();
有效。