あるテーブルから別のテーブルに列をコピーする (式と見出しを持ってくる)やあ。 私は2つのテーブルを持っています。必要な見出しと数式を含むもの。
そして、他のテーブルには式のあるテーブルがあります。 あるテーブルから別のテーブルに列をコピーする (式と見出しを持ってくる) 方法を教えてください。 ありがとう
Re: あるテーブルから別のテーブルに列をコピーします (式と見出しを持ってきます)元の投稿がスクリプトを使用してコピーを行っていない場合は、次のことを行う必要があります。
テーブル==>サブセット
以下は、より完全に注釈を付けたバージョンのスクリプトです。
// This script creates a couple of example data tables and then runs
// a little script that copies all of the columns from the originating
// data table to a new data table
// Setup the memory environment
Names Default To Here( 1 );
// Create an example data table that has some formula columns
// The variable "dt" is used as a pointer to this data table
dt = New Table( "Source",
add rows( 20 ),
New Column( "A", formula( Random Integer( 1, 10 ) ) ),
New Column( "B", formula( Random Integer( 20, 30 ) ) )
);
dt << run formulas;
// Create a new data table that will be used to create the new
// columns in
// Variable "dt2" is used to point to this data table
dt2 = New Table( "Copy", add rows( 10 ) );
// Create the columns and set the names and formula
// Loop across all columns in the Originating data table
// and retireve the name and formula and then create a new
// column in the new data table
For( i = 1, i <= N Cols( dt ), i++,
// Create the new column in the new data table, giving it
// the name from the current data table
dt2 << New Column( Column( dt, i ) << get name );
// Get the formula from the originating data table
theFormula = Char( Column( dt, i ) << get formula );
// Set the formula into the new data table
Eval(
Parse(
"Column( dt2, Column( dt," || Char( i ) || ")<< get name ) <<
set formula( " || theFormula || ");"
)
);
);Re: あるテーブルから別のテーブルに列をコピーします (式と見出しを持ってきます)ありがとね! 申し訳ありませんが、スクリプトを理解できません。 別の方法で説明していただけますか?Re: あるテーブルから別のテーブルに列をコピーします (式と見出しを持ってきます)これを行う1つの方法の例を次に示します
Names Default To Here( 1 );
dt = New Table( "Source",
add rows( 20 ),
New Column( "A", formula( Random Integer( 1, 10 ) ) ),
New Column( "B", formula( Random Integer( 20, 30 ) ) )
);
dt << run formulas;
dt2 = New Table( "Copy", add rows( 10 ) );
// Create the columns and set the names and formula
For( i = 1, i <= N Cols( dt ), i++,
dt2 << New Column( Column( dt, i ) << get name );
theFormula = Char( Column( dt, i ) << get formula );
Eval(
Parse(
"Column( dt2, Column( dt," || Char( i ) || ")<< get name ) <<
set formula( " || theFormula || ");"
)
);
);