レポート出力をデータ テーブルに保存すると、多くの場合、長い列名が作成され、その後の分析で煩雑になります。 これは、選択した列の名前からテキストを置換/削除する愚かな小さなスクリプトです。
使用法: 変更する列を選択し、スクリプトを実行し、変更する必要があるテキスト (スペースを含む) を入力してから、変更するテキストを入力します (これもスペースを含みます。何も置き換えない場合は空白のままにします)。
明らかに、開いているデータ テーブルがない場合、スクリプトは何も行いません。 列が選択されていない場合、つまり、変更が必要であると識別された列がない場合、スクリプトは現時点では何も行いませんが、列を選択するプロンプトが追加される可能性があります。
更新: 検索するテキストを簡単に示すために、最初に選択した列名がテキスト ボックスに含まれます。
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」のアクセスまたは評価で次を取得
解決策はありますか?
投稿していただきありがとうございます...これをアドインにする方法はありますか?