보고서 출력을 데이터 테이블에 저장하면 후속 분석에서 번거로운 긴 열 이름이 생성되는 경우가 많습니다. 이것은 선택한 열의 이름에서 텍스트를 바꾸거나 제거하는 어리석은 작은 스크립트입니다.
사용법: 수정하려는 열을 선택하고 스크립트를 실행하고 변경해야 할 텍스트(공백 포함)를 입력한 다음 변경할 텍스트를 입력합니다(역시 공백 포함, 아무것도 바꾸지 않으려면 공백으로 두십시오).
분명히 열려 있는 데이터 테이블이 없으면 스크립트는 아무 작업도 수행하지 않습니다. 선택한 열이 없거나 변경이 필요한 것으로 식별된 열이 없는 경우 열을 선택하라는 메시지가 추가될 수 있지만 스크립트는 현재 아무 작업도 수행하지 않습니다.
업데이트: 찾을 텍스트를 더 쉽게 표시할 수 있도록 처음 선택한 열 이름이 텍스트 상자에 포함됩니다.
Here is the updated script (the only change was to add << Return Result, so the Text Box would return what was entered (not sure why it worked before):
//!
// Initialize
Names Default to Here( 1 );
Clear Log();
dt = Current Data Table( );
// Stop the script if no open data tables
If( Is Empty( dt ), Stop());
cols = dt << Get Selected Columns( );
// Stop the script if no columns selected
If( N Items( cols ) == 0, Stop());
// Prompt user for text to remove
eBox1 = New Window(
"Find",
<< Modal,
<< Return Result,
Text Box(
"What text should be removed from the column names
(including spaces, i.e. delete the text you want to keep)?",
Justify Text ("Center"),
Set Width(500)
),
Spacer Box( Size( 12.5, 12.5 ) ),
editBox = Text Edit Box(cols[1] << Get Name()),
editBox << Set Width(500),
Spacer Box( Size( 12.5, 12.5 ) ),
H List Box( Button Box( "OK",
remove this = editBox << Get Text;
// Stop the script if the user doesn't enter any text
If( remove this == "", Stop())
),
Button Box( "Cancel" ),
<< Horizontal Alignment( "Center" )
)
);
// Stop the script if the user hits the cancel button
If( eBox1["Button"] == -1, Print("Canceled"); Stop());
// Prompt user for text to replace
eBox2 = New Window(
"Replace With",
<< Modal,
<< Return Result,
Text Box(
"What should the text be replaced with
(including spaces, or leave blank)?",
Justify Text ("Center"),
Set Width(300)
),
Spacer Box( Size( 12.5, 12.5 ) ),
editBox2 = Text Edit Box(),
editBox2 << Set Width(300),
Spacer Box( Size( 12.5, 12.5 ) ),
H List Box( Button Box( "OK",
replace with = editBox2 << Get Text
),
Button Box( "Cancel" ),
<< Horizontal Alignment( "Center" )
)
);
// Stop the script if the user hits the cancel button
If( eBox2["Button"] == -1, Print("Cancled"); Stop());
// Loop through the columns adding the tag to the end of the existing name
For( i = 1, i <= N Items( cols ), i++,
cols[ i ] << set name( munger(cols[ i ] << get name, 1, remove this, replace with))
); // Next column
// End업데이트가 게시되기까지 약간의 시간이 걸릴 수 있습니다.
답변하는 데 시간이 너무 오래 걸려서 죄송합니다. 여기에 게시하는 것을 잊어버렸습니다. 예, 고칠 수 있습니다. - 완료
공유해 주셔서 감사합니다.
하지만 이 훌륭한 추가 기능은 JMP16에서는 사용할 수 없습니다.
오류 메시지가 표시됩니다: 삭제된 객체 참조:editbox<<'Glue'에 대한 액세스 또는 평가에서 다음 가져오기
그것에 대한 해결책이 있습니까?
게시해 주셔서 감사합니다... 이 기능을 추가 기능으로 만드는 방법이 있나요?