私は毎日この表を更新する必要があります(下記の通り)

私は毎日新しい商品ID&recipe_A&recipe_Bを更新します。
それから私はソートする必要があります他の2つにrecipe_Aとrecipe_B 列(sort_Aとsort_B)
だから私はコピー recipe_Aとrecipe_Bをsort_Aとsort_Bにコピーし、このスクリプトを実行します(下記参照)。
このようにして、私は書き直すことができます sort_Aとsort_B
Current Data Table() << Begin Data Update;
For Each Row( :sort_A = Match( :sort_A, "ZXC", "worse", "QWE", "better", "ASD", "good", :sort_A ) );
Current Data Table() << End Data Update;
Current Data Table() << Begin Data Update;
For Each Row( :sort_B = Match( :sort_B, "R123", "rrr", "H123", "hhh", "G123", "ggg", :sort_B ) );
Current Data Table() << End Data Update;
私の質問は:
recipe_Aとrecipe_Bをsort_Aとsort_Bに自動コピーするスクリプトを作成する方法?
(sort_Aとsort_Bのデータがない場合は自動コピー)
以下は、sort_Aまたはsort_B列が存在するかどうかを確認し、存在しない場合は作成してデータを追加するためのコードの見直しです。 存在する場合は、それを再設定します。 sort_Aとsort_Bの結果はrecipe_Aとrecipe_Bの値に基づいているため、値をsort_Aとsort_Bにコピーしてからそれぞれの値を変更する必要はありません。 recipe_Aとrecipe_Bの値を使用してsort_Aとsort_Bの値を設定する方がはるかに簡単です。
Names Default To Here( 1 );
dt = Current Data Table();
// Get a list of the current columns in the data table
ColList = dt << get column names( string );
// See if a column named "sort_A" does not exist
If( N Rows( Loc( ColList, "sort_A" ) ) == 0,
// If it does not exist, create the new column and use a formula to populate the values based upon the recipe_A values
dt << New Column( "sort_A", character, formula( Match( :recipe_A, "ZXC", "worse", "QWE", "better", "ASD", "good", :recipe_A ) ) );
// Remove the formula which will leave the results
dt:sort_A << delete formula;
,
// If the column already exists, then loop through the data table creating new values for sort_A based upon the recipe_A values
For Each Row( :sort_A = Match( :recipe_A, "ZXC", "worse", "QWE", "better", "ASD", "good", :recipe_A ) )
);
// See if a column named "sort_B" does not exist
If( N Rows( Loc( ColList, "sort_B" ) ) == 0,
// If it does not exist, create the new column and use a formula to populate the values based upon the recipe_B values
dt << New Column( "sort_B", character, formula( Match( :recipe_B, "R123", "rrr", "H123", "hhh", "G123", "ggg", :recipe_B ) ) );
dt:sort_B << delete formula;
,
// If the column already exists, then loop through the data table creating new values for sort_B based upon the recipe_B values
For Each Row( :sort_B = Match( :recipe_B, "R123", "rrr", "H123", "hhh", "G123", "ggg", :recipe_B ) )
);