Calculation Pull

Apr 16, 2014 at 6:52 PM
It would be great, along side the push capabilities of the calculation tab, to have a pull. As often is the case, I have to compare the text between whats in my source control with whats on a qa server.

Usually, I end up just creatting a toss project from an existing ssas cube, just to get to the calculation tab.

I could envision, a button that asks what server and cube to extract from, then save to location as a file, or import it and overwrite the current calculation tab values.

Thanks
Coordinator
Apr 17, 2014 at 12:43 AM
I'm not sure I like the concept of pulling part of a solution. If there are structural changes or if object names have been changed you could break the whole solution.

Couldn't you just use the SmartDiff feature to compare your current solution on your dev machine with a specific version from source control?

Another approach would be to just use a PowerShell script like the following to dump all the calcs from a given cube

$serverName="localhost"
$databaseName = "AdventureWorks"
$cubeName = "Model"
$outputFile = 'D:\data\calcscript.txt'

load the AMO into the current runspace

[System.Reflection.Assembly]::LoadwithpartialName("Microsoft.AnalysisServices") > $null

connect to the server

$svr = new-Object Microsoft.analysisservices.Server

delete file if it exists

if (Test-Path $outputFile) { del $outputfile -force }

write out all commands

$svr.Connect($serverName)
$db = $svr.Databases.GetByName($databaseName)
$cube = $db.Cubes.GetByName($cubeName)
foreach ($cmd in $cube.MDXScripts[0].Commands)
{
$cmd.Text | out-file $outputFile -append
}
$svr.Disconnect()
Marked as answer by furmangg on 3/17/2015 at 5:52 PM