이 테이블을 매일 업데이트해야합니다 (아래 참조).

매일 새로운 제품 ID & recipe_A & recipe_B를 업데이트하겠습니다.
그런 다음 정렬해야합니다. recipe_A & recipe_B 다른 두 개의 recipe_A & recipe_B 열 (sort_A & sort_B).
그래서 나는 복사한다. recipe_A & recipe_B를 sort_A & sort_B로 설정하고이 스크립트를 실행하십시오 (아래 참조).
이 방법으로, 나는 recode 할 수있다. 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 ) )
);