rory qin Posted July 9, 2023 Share Posted July 9, 2023 hi, with ironpython script I can get a new table everyday. In the table I want to add a column whose value set as date when the table generated.-------newTableName= str(date.today())Document.Data.Table.Add(newTableName,datasource)newcol = "date"cols = Document.Data.Tables[newTableName].Columnscols.AddCalculatedColumn(newcol,"???")-------what formula should be in "???" or any other way to assign new column value?--------I tried to store date in one column property of the daily generated table.However, I don't know how to call it in the formula"???" Link to comment Share on other sites More sharing options...
Fredrik Rosell Posted July 10, 2023 Share Posted July 10, 2023 Hello,If you do already have an existing data table and want to add a column to that, you can use the DateTimeNow() function in your custom expression (that gives a date time). Example cols.AddCalculatedColumn(newcol,"DateTimeNow()")To just get a date instead, use the Date function to convert it: Date(DateTimeNow()) Note: I don't understand the exact use case you have, but if there is no existing data table and for some reason you want to add this new data table just containing the current date, you can e.g. find inspiration here: https://community.spotfire.com/s/article/IronPython-script-to-Add-Rows-With-Zero Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now