How to create unpivot tranformation using ironpython for multiple columns

Hi all, Need help

I need to automate unpivot tranformation, code from the link take only one column as a parameter.

https://community.tibco.com/questions/how-create-unpivotted-table-iron-p...

How to pass multiple columns as Identity and value columns.

In addition to that, can we print all the columns ina data table?

 

Script from the link

 

from Spotfire.Dxp.Data import DataFlowBuilder

from Spotfire.Dxp.Data import DataColumnSignature

from Spotfire.Dxp.Data.Import import DataTableDataSource

from Spotfire.Dxp.Data.Transformations import UnpivotTransformation

from System.Collections.Generic import List, IList

ds=DataTableDataSource(Document.Data.Tables["Scenario"])

dfb=DataFlowBuilder(ds,Application.ImportContext)

pt=UnpivotTransformation()

IdentityCols=[]

IdentityCols.append(DataColumnSignature(Document.Data.Tables["Scenario"].Columns["Date"]))

ValueCols=[]

ValueCols.append(DataColumnSignature(Document.Data.Tables["Scenario"].Columns["Scenario 3"]))

pt.IdentityColumns=List[DataColumnSignature](IdentityCols)

pt.ValueColumns=List[DataColumnSignature](ValueCols)

dfb.AddTransformation(pt)

flow=dfb.Build()

newTable=Document.Data.Tables.Add(flow.DocumentTitle,flow)

(1) Answer

Login