When converting a missing Numeric value to Char, Char() will return ".". Is there a simple way to return ""?
(I know I can wrap with If( Is Missing( )), but this seems unnecessarily cumbersome.
New Table( "Missing Numeric to Char",
Add Rows( 1 ),
New Column( "Numeric", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [.] ) ),
New Column( "Is Numeric Missing?", Numeric, "Continuous", Format( "Best", 12 ), Formula( Is Missing( :Numeric ) ) ),
New Column( "Char", Character, "Nominal", Formula( Char( :Numeric ) ) ),
New Column( "Is Char Missing?", Numeric, "Continuous", Format( "Best", 12 ), Formula( Is Missing( :Char ) ) ),
New Column( "Really cumbersome method", Character, "Nominal", Formula( If( Is Missing( :Numeric ), "", Char( :Numeric ) ) ) ),
New Column( "Is Really cumbersome method missing?",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula( Is Missing( :Really cumbersome method ) )
)
);
一番簡単なのは、If + Is Missing を使うことだと思います。あなたのように that を使う方が分かりやすいですが、"" を省略することもできます。
If(!IsMissing(:numeric), Char(:numeric))
数式が必要ない場合は、データ型を変更するだけです。
ありがとう。期待したほどエレガントではないけど、ちゃんと機能してる。