List Dynamic Calc Members

What is this?

This morning my functional users were having issues with some older calculations due to DynamicCalc members being in the fix statement. Apparently some members in the outline were changed recently, within the last couple months, and no one updated the calculations, tracked the outline changes or did regression testing.

I try to subscribe to the concept that anything that can be done programtically should be. You never know when you will have to do something again.

Outline Extract

First I threw together a quick little outline extract script for use with MaxL. I know a lot of people out there use the OlapUnderground Outline Extractor, but I prefer to use the built-in XML extract command that was introduced in 11.1.2.x. It's much faster on large outlines and should be future proof.

File: export_outine.maxl

login $1 identified by $2 on localhost;
export outline Sample.Basic all dimensions to xml_file 'output.xml';

Execution: essmsh export_outline.maxl admin password

Parsing the XML

Lately my scripting language of choice has been Python/Jython. It works pretty much everywhere and is able to acomplish many tasks with few lines of code. In this script, I have python parse the XML file looking for outline members with the DataStorage attribute defined. I then print the member name if the DataStorage attribute value is DynamicCalc.


from xml.dom import minidom
xmldoc = minidom.parse('output.xml')
items = xmldoc.getElementsByTagName('Member')
for s in items:
    # print s
    if s.hasAttribute('DataStorage') and s.attributes['DataStorage'].value == 'DynamicCalc':
        print s.attributes['name'].value

Execution: python

Final Thoughts

Part of me would love to spend more time on this to make it parameterized, but seeing as how I've spent three times as long writing the blog entry as it took to write the script I'll leave it as is.