변수 이름이 일치하지 않는 경우 오류 플래그 지정안녕하세요 여러분,
사용자 정의 변수 이름의 변수 이름이 기존 테이블 변수 이름과 일치하는 경우 오류를 표시하는 간단한 오류 트랩을 만들고 싶습니다. 예를 들면 아래와 같습니다.
사용자 정의 데이터 테이블
변수 이름
1. 벤젠
2. 메탄
3. 에탄
기존 데이터 테이블
변수 이름
1. 벤젠
2. 메탄
3. 에탄
4. 프로판
5. 펜탄
6. 헥산
!contains 함수를 사용해 보았지만 구문을 제대로 사용하지 않는 것 같습니다. 저는 jmp 스크립트를 처음 접하기 때문에 커뮤니티에서 누군가를 찾고 있습니다.
Inputdt = User Defined Data Table Name
mvdt = Existing Data Table Name
//Get required variable lists from user define Data Table
varListInput = Column( Inputdt, "Variable Name" ) << get values;
// Error trap - if # UserDefinedTable & # Existing Data Table variables don't match, then break code & output error message.
//Obtain column names from existing Data Table from list
colnames = mvdt << get column names( string );
show(colnames);
show(varListInput);
If(!contains Item ("colnames", "varListInput"),
Message = Dialog( "The Variable Name does not match with Existing Data Table.Please correct your Input Table." );
Stop();
);스크립팅Re: 변수 이름이 일치하지 않으면 오류 플래그 지정Contains Items() 함수를 사용하려면 데이터가 연관 배열에 있어야 합니다.항목이 목록에 있는 경우 아래 방법이 작동합니다.
Inputdt = User Defined Data Table Name
mvdt = Existing Data Table Name;
//Get required variable lists from user define Data Table
varListInput = Column( Inputdt, "Variable Name" ) << get values;
// Error trap - if # UserDefinedTable & # Existing Data Table variables don't match, then break code & output error message.
//Obtain column names from existing Data Table from list
colnames = mvdt << get column names( string );
show(colnames);
show(varListInput);
For( i = 1, i <= N Items( varListInput ), i++,
If( !Contains( colnames, varListInput[i] ),
Message = Dialog(
"The Variable Name does not match with Existing Data Table.Please correct your Input Table."
);
Stop();
)
);