cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
fitri
Level II

Create New Column with variables

Hi all,

I am trying to create a new column with formula, which represented by 2 variables as below:

dt << New Column("myNewColumn", Numeric, Continuous, Formula(:Ceiling( XXColumn / Size) * Size));

where:

XXColumn is one of column name in dt, selected in column dialog

Size = numeric value from column dialog

My attempt resulted a new column with formula with no value as formula create as below:

Ceiling(Column(XXColumn ) / Size) * Size

without actually assign it.

Any idea how I can accomplish this?

12 REPLIES 12
fitri
Level II

Re: Create New Column with variables

finally the magic happened !!!

here is the code i used..

col = dts << New Column("Binning", Numeric, Continuous);

Eval( Parse( Eval Insert( "col << Set Formula(:Ceiling( ^n_Bin^ / ^BinSize^) * ^BinSize^)<< eval formula" )) );

Thank You MS for the guidance; what is the diff on f_bin and n_bin i used?

ms
Super User (Alumni) ms
Super User (Alumni)

Re: Create New Column with variables

As far as I could tell from reading your code f_Bin refers to a column whereas n_Bin is a string, which is the data type that is safest to use here.

fitri
Level II

Re: Create New Column with variables

Thank you again, MS. I shall take note on this.