Jump to content
We've recently updated our Privacy Statement, available here. ×

How to add calculated column to OSI PI Datasource before adding data to rows of table


Michael Springer 2

Recommended Posts

I have a data source that I got from OSI PI and add to an existing data table if it exists:

ds = DataSourceImpl(pm)

 

if Document.Data.Tables.Contains(dt_name):

column_settings = AddRowsSettings(Document.Data.Tables[dt_name], ds)

Document.Data.Tables[dt_name].AddRows(ds, column_settings)

else:

Document.Data.Tables.Add(dt_name, ds)However, I would like to calculate a new column based on values from the data source. I want the combined data source data and new calculated column added as rows to an existing datatable. How would I add this

Link to comment
Share on other sites

  • 1 month later...

Hello,

Your question is not very clear but if you would like to add a calculated column to a data table this is how you can do it -

from Spotfire.Dxp.Data import CalculatedColumn

 

cols = Document.Data.Tables["MyTable"].Columns

 

cols.AddCalculatedColumn("ThisIsACalculatedColumn", "Expression");If this is not what you are looking for please elaborate your question.

 

Thanks!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...