모달 대화 상자의 입력이 필요한 플랫폼의 출력을 자동화하는 것이 어떻게 가능합니까?
아래에는 두 가지 예가 있습니다. 첫 번째 방법은 대화 상자에서 모든 옵션을 지정할 때 작동합니다.
모든 옵션을 지정하는 것이 가능하다면 두 번째 방법도 같은 방식으로 작동할 것으로 기대합니다. 내 생각에는 일부 옵션이 올바른 이름이나 구문을 사용하지 않는 것 같습니다(불행히도 Jmp는 디버깅 정보를 제공하지 않습니다). 아래 예를 참조하세요(Jmp 14 EA 7에서 작동)...
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
//This Works when all options in Save Document Matrix are specified:
te=dt<<TEXT explorer=""></TEXT>
일반적으로 Recode 대화 상자는 스크립팅할 수 없습니다. JMP의 향후 릴리스에서 고려할 수 있도록 귀하의 피드백을 JMP 개발 팀에 전달했습니다.
JMP를 이용해 주셔서 감사합니다!
답장을 보내주셔서 감사합니다. 언젠가는 Levenshtein 거리가 유용할 것입니다.
일반적으로 스크립팅을 통해 플랫폼의 마지막 부분을 자동화하는 방법을 찾고 있습니다. 이에 대한 문서가 없거나 적어도 찾을 수 없다는 것을 알고 있지만 첫 번째 예에서 볼 수 있듯이 호출 시 모든 값이 제공되면 모달 대화 상자를 피할 수 있습니다. 모든 대화 상자에서 작동하는지 확신할 수 없지만 하나에서 작동했기 때문에 일반적으로 작동할 가능성이 높다고 생각합니다. 그렇지 않으면 개발자들에게 이 작업을 수행하여 반복적인 작업을 피하고 플랫폼과 Jmp 스크립팅의 잠재력을 최대한 발휘할 수 있도록 간청합니다!
불행히도 모달 대화 상자를 클릭하지 않고는 상자가 스스로 닫히지 않는 한 사라지게 할 방법이 없습니다. 이 경우 레코딩을 직접 스크립팅할 수 있습니다. 가장 어려운 부분은 문자열 거리 함수를 찾거나 작성하는 것입니다.
아래 스크립트는 시작하는 데 도움이 될 수 있지만 이 거리 함수를 있는 그대로 사용하지 마십시오. 매우 비효율적입니다!5글자의 단어에서 2의 거리는 많이 있지만 'JANE', 'JAMES', 'JOE'가 모두 'JANE'이 되는 것을 볼 수 있습니다.
Names default to here( 1 );
// FUNCTION TO CALCULATE DISTANCE BETWEEN STRINGS
//Rewrite of example C code from wikipedia:
//https://en.wikipedia.org/wiki/Levenshtein_distance
//very inefficient
// len_s and len_t are the number of characters in string s and t respectively
LevenshteinDistance_ = function({s, len_s, t, len_t},
// show(s || char(len_s) || t || char(len_t));
// base case: empty strings
if ( substr( s, 1, len_s ) == substr( t, 1, len_t ), 0, //strings match, distance is zero
len_s == 0, len_t, //s empty, distance is the length of t
len_t == 0, len_s, //t empty, distance is the length of s
// return minimum of delete char from s, delete char from t, and delete char from both
minimum(
LevenshteinDistance_(s, len_s - 1, t, len_t ) + 1,
LevenshteinDistance_(s, len_s , t, len_t - 1) + 1,
LevenshteinDistance_(s, len_s - 1, t, len_t - 1) +
if (substr(s, len_s, 1) == substr(t, len_t, 1), 0, 1) // test if last characters of the strings match
);
);
);
//Wrapper that finds strings lengths for you
LevenshteinDistance = function({s, t}, LevenshteinDistance_(s, length(s), t, length(t)));
// EXAMPLE
//data table
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << New Column( "name recoded", Character, "Nominal" );
//replace names with the first name in the table having a Levenshtein
//distance of two or less when compared to that value
for( i = 1, i <= min(15, N Rows( dt )), i++, //for each row in the table
//if row one always use that value
Column( dt, "name recoded")[i] = if( i == 0, Column( dt, "name")[i], <BR />
newvalue = Column(dt, "name")[i]; //assume you will use this rows' value<BR />
match = 0; //flag indicating that a match is found
for( j = 1, j < i & match == 0, j++, //look at all previous rows to find a match
//if a match use the previous row value and stop looking for more matches
if( LevenshteinDistance( Column(dt, "name")[i], Column(dt, "name")[j] ) <= 2,
newvalue = Column(dt, "name")[j];
match = 1;
)
);
newvalue;
);
);