取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
See how to use to use Text Explorer to glean valuable information from text data at April 25 webinar.
选择语言 隐藏翻译栏
查看原发布的话题

How to add columns with empty data

sirihofstadtrap
Level II

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 个已接受解答

已接受的解答
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

在原帖中查看解决方案

2 条回复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 :)