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

How to add columns with empty data

I have a table similar to this:

 xyz xyzxyz
aa12  .3
bb    ..
cc2 3 .5

The columns have rows containing both numeric and empty data.

I want to create a new column (xyz) where I add the data in column x, y and z.

In other words, I want the result to look like the green xyz-column.

 

The problem is, when I run my script, I get the result in the red xyz-column..

How do I add columns with empty data?

 

I use the following script to create the xyz-column:

dt << New Column("xyz",

         Numeric,

         Formula(:Name("x")+:Name("y")+:Name("z")

         )

         );

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How to add columns with empty data

Use:

dt << New Column( "xyz", Numeric, Formula( Sum( :x, :y,:z ) ) );

 The Sum() function ignores missing values.

Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: How to add columns with empty data

Use:

dt << New Column( "xyz", Numeric, Formula( Sum( :x, :y,:z ) ) );

 The Sum() function ignores missing values.

Jim

Re: How to add columns with empty data

Thank you, it works :)