How to create new hierarchy column in data table by IronPython script?

Hi All!

Does anybody faced the necessity to create new hierarchy column by python script?

It's possible to make hierarchy by application menu. In this case I can extract query from column property dialog:

  [Year] AS [Year],
  [QuarterName] AS [QuarterName],
  [MonthName] AS [MonthName],
  [WeekName] AS [WeekName]

But I need to create calendar table by script (it's done) and then add hierarchy column (to use it as tree filter).

I can create column Calendar (in table Calendar) as String, then change it's type to Hierarchy.

from Spotfire.Dxp.Data import DataColumnType

    Document.Data.Tables['Calendar'].Columns['Calendar'].Properties.ColumnType = DataColumnType.Hierarchy

But how to assign hierarchy values... from existing columns?


Many thanks for any suggestions or script example!




(1) Answer