나는 다음을 받았습니다. 내가 논의하고 싶은 공식 거의 3년전부터 @txnelson , 그 이후로 결코 놓지 않았고 지금까지 여러 번 생각하면서 천천히 스크립팅을 좀 더 진지하게 이해하게 되었습니다. 그동안 저를 구해준 공식은 많이 시간의.
아래 예에서는 동일한 수식을 매번 조금씩 변형하면서 3번 추가합니다. 제가 논의하고 싶은 문제는 새로 추가된 수식 열을 포함하여 테이블의 테이블 스크립트를 복사하고 실행할 때 발생하는 다양한 오류 메시지입니다.
Names Default To Here( 1 );
// first, we need an example table
dt = New Table( "ExampleTable",
Add Rows( 24 ),
New Column( "BatchId",
Character,
"Nominal",
Set Values(
{"A", "A", "A", "A", "A", "A", "B", "B", "B", "C", "C", "C", "D", "D",
"D", "E", "E", "E", "F", "F", "F", "G", "G", "G"}
)
),
New Column( "StorageCondition",
Character,
"Nominal",
Set Values(
{"25°C/60%RH", "25°C/60%RH", "25°C/60%RH", "5°C", "5°C", "5°C",
"25°C/60%RH", "25°C/60%RH", "25°C/60%RH", "25°C/60%RH", "25°C/60%RH",
"25°C/60%RH", "25°C/60%RH", "25°C/60%RH", "25°C/60%RH", "25°C/60%RH",
"25°C/60%RH", "25°C/60%RH", "25°C/60%RH", "25°C/60%RH", "25°C/60%RH",
"25°C/60%RH", "25°C/60%RH", "25°C/60%RH"}
)
),
New Column( "Time",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values(
[0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2]
)
),
New Column( "QcParameter",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values(
[0.2, 0.3, 0.4, 0.2, 0.21, 0.22, 0.3, 0.9, 1.2, ., 0.2, 0.4, 0.1, ., 0.1,
0, 0, 0, 0.1, 0, 0, 0, 0.1, 0]
)
)
);
// adding formula column via approach nr. 1<BR />// this adds the formula alright, but when copying and executing the resulting table script will leave the formula column empty<BR />// no need to discuss this, because this obviously missing the 'eval(eval expr(expr()))' wrapping (see screenshot below)
dt << New Column( "QcParameter [% rel.]_1",
numeric,
formula(
curBatch = :BatchId;
curCondition = :StorageCondition;
theRows = dt << get rows where(
:BatchId == curBatch & :StorageCondition == curCondition & :Time == 0
);
d0Row = theRows[1];
d0Time = :QcParameter[d0Row];
(100 * :QcParameter / d0Time);
)
);
// adding formula column via approach nr. 2<BR />// this will fill the formula column as desired when copying and running the table script with the added formula columns<BR />// but it will also throw an error message when new rows are added to the table then (see screenshot below)
Eval(
Eval Expr(
dt << New Column( "QcParameter [% rel.]_2",
numeric,
formula(
curBatch = :BatchId;
curCondition = :StorageCondition;
theRows = Expr( dt ) << get rows where(
:BatchId == curBatch & :StorageCondition == curCondition & :Time == 0
);
d0Row = theRows[1]; // removed from approach nr. 3
d0Time = :QcParameter[d0Row];
(100 * :QcParameter / d0Time);
)
)
)
);
// adding formula column via approach nr. 3
// this will fill the formula column as desired when copying and running the table script with the added formula columns<BR />// and it will NOT throw an error message when new rows are added to the table then (see screenshot below)
Eval(
Eval Expr(
dt << New Column( "QcParameter [% rel.]_3",
numeric,
formula(
curBatch = :BatchId;
curCondition = :StorageCondition;
theRows = Expr( dt ) << get rows where(
:BatchId == curBatch & :StorageCondition == curCondition & :Time == 0
);
d0Time = :QcParameter[theRows];
(100 * :QcParameter) / d0Time;
)
)
)
);
추가 수식 열을 사용하여 테이블 스크립트를 다시 실행할 때 수식 열 "QcParameter [%r rel.]_1]"에 대한 오류 메시지 스크린샷:

추가 수식 열을 사용하여 테이블 스크립트를 다시 실행할 때 수식 열 "QcParameter [%r rel.]_2]"에 대한 오류 메시지 스크린샷:

추가 수식 열을 사용하여 테이블 스크립트를 다시 실행할 때 수식 열 "QcParameter [%r rel.]_3]"에 대한 오류 메시지 스크린샷:

제가 이렇게 긴 질문을 드리는 이유는 제가 가정하기 때문입니다. 접근 nr에 변수 "d0Row"가 사용된 데는 어떤 이유가 있을 것입니다. 2, 아니?접근 번호의 경우. 3 간단히 이 변수를 삭제했고(아래 스크린샷 참조) 결과적으로 수식이 "훨씬 더 훌륭하게" 작동합니다. 즉, 새 행이 데이터 테이블에 포인트 앤 클릭 방식으로 임시 추가될 때 오류 메시지가 없습니다.

따라서 내 질문은 "d0Row" 변수를 삭제하여 뭔가 잘못하고 있는지입니다. 실제로는 더 큰 데이터 테이블을 사용하여 작업하므로 각 행의 정확성을 개별적으로 확인할 수 없습니다.