Friday, February 24, 2012

Cube Actions, how can I create a Command line action

In Analysis 2000 there was a command line action type, how can I do the same action in Analysis Services 2005?

Analysis 2000 command line action:

Defines an MDX statement that can be executed as a command line and displays the contents of the current directory:

"cmd /k dir"

Peter,

The DDL for AS2K5 still supports HTM and Command Line actions, but they are not exposed in the Business Intelligence Development Studio (BIDS). One work around that I have used is to create a URL action in BIDS and then save the cube definition and deploy it. Then you use SQL Server Management Studio to generate an ALTER CUBE script to an XMLA query window. Do a search on the script to find your action and then just change the type as show here:

Original script (segment with action definition)

<Action xsi:type="StandardAction">

<ID>Action</ID>

<Name>Command Line Action</Name>

<TargetType>Cells</TargetType>

<Type>URL</Type>

<Expression>"cmd /k dir"</Expression>

</Action>

Modified script

<Action xsi:type="StandardAction">

<ID>Action</ID>

<Name>Command Line Action</Name>

<TargetType>Cells</TargetType>

<Type>CommandLine</Type>

<Expression>"cmd /k dir"</Expression>

</Action>

Then just execute your script and the action type will be set to Command Line.

HTH,

- Steve

|||

Steve,

When I modify the script It still not works?

<Action xsi:type="StandardAction" dwd:design-time-name="f542b1b2-b2b6-4bf8-9903-63150db6ed15">
<ID>Action 1</ID>
<Name>CMD</Name>
<Description></Description>
<Caption></Caption>
<TargetType>Cells</TargetType>
<Target></Target>
<Condition></Condition>
<Type>CommandLine</Type>
<Application></Application>
<Expression>"cmd /k /dir"</Expression>
</Action>

When I change it back into URL the action works fine.

<Action xsi:type="StandardAction" dwd:design-time-name="f542b1b2-b2b6-4bf8-9903-63150db6ed15">
<ID>Action 1</ID>
<Name>CMD</Name>
<Description></Description>
<Caption></Caption>
<TargetType>Cells</TargetType>
<Target></Target>
<Condition></Condition>
<Type>Url</Type>
<Application></Application>
<Expression>"http://www.mywebsite.com"</Expression>
</Action>

|||

Peter,

I believe the problem is in the "Expression" you supplied to the command line action. It should be "cmd /k dir" and you have "cmd /k /dir"

<Expression>"cmd /k /dir"</Expression>

No comments:

Post a Comment