JMPデータテーブルの更新<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />JMP データ テーブルを週に 2 ~ 3 回更新するために使用する Excel テーブルがあります。ただし、Excel ファイルを取得した後、Tables プラットフォームを使用して更新を実行すると、ソース スクリプトが変更されます。ソース スクリプトは、テーブル更新プラットフォームで実行されるステップに変更されます。なぜこうなった?手順が足りませんか?
Re: JMP データテーブルの更新リストからスクリプト名を取得するプロセスを自動化するループの問題を解決しました。更新されたテーブルが動的に作成され、元のテーブルに含まれるスクリプトがすべて新しいテーブルに移動されるようになりました。
最終バージョンにコメントを付け、他の人がこのソリューションを使用する必要がある場合に備えて以下に含めます。
あなたのすべての協力に感謝します。
デイブ
//
// The purpose of this script is to create an updated JMP data table based on the same source
// data file used to create the JMP data table currently open.
//
// This script is used when you have created a JMP data table from a source data file that is
// updated over time and will continue to "grow" with new data as time progresses. Examples of
// this type of file is a monthly time accounting record or a periodic production report.
//
// This script is focused on source data that is "added to" as time progresses and is not intended
// for source data that contains only data for the given period with no historical data retained.
//
// The script utilzes the original "Open" command found within the "Source" script of the JMP data table
// and then copies over all of the scripts from the original data table into the new "updated" data table.
dtCurrent = Current Data Table();
// copy the Open command from the "Source" script of the main data table
// this is only required once as long as the name and location of the source data file remains unchanged
dtUpdate = Open(
"Z:\JMP Data Analysis\SLOC Metrics\Data Update Testing\Project_Metrics.xlsx",
Worksheets( "Code_Change_Metrics" ),
Use for all sheets( 1 ),
Concatenate Worksheets( 0 ),
Create Concatenation Column( 0 ),
Worksheet Settings(
1,
Has Column Headers( 1 ),
Number of Rows in Headers( 1 ),
Headers Start on Row( 1 ),
Data Starts on Row( 2 ),
Data Starts on Column( 1 ),
Data Ends on Row( 0 ),
Data Ends on Column( 0 ),
Replicated Spanned Rows( 1 ),
Replicated Spanned Headers( 0 ),
Suppress Hidden Rows( 1 ),
Suppress Hidden Columns( 1 ),
Suppress Empty Columns( 1 ),
Treat as Hierarchy( 0 ),
Multiple Series Stack( 0 ),
Import Cell Colors( 0 ),
Limit Column Detect( 0 ),
Column Separator String( "-" )
)
);
// end of the Open command from the "Source" script of the main data table
// don't forget to add the semicolon after the closing ")" above since we are added more commands below
// Get the list of scripts that are contained within the main data table
lstScriptNames = dtCurrent << Get Table Script Names;
// Loop through all the script names and move them to the updated dat table
For( i = 1, i <= N Items( lstScriptNames ), i++,
// pull each script name from the list of scripts
scriptName = lstScriptNames[ i ];
// By opening the updated data file with the copied Open command, we already created the "Source" script
IF(scriptName != "Source",
// Get the "contents" of this script from the main data table
scriptDef = dtCurrent << get table variable( scriptName );
// Insert this script into the updated data table
Eval(
Parse(
Eval Insert( "dtUpdate << New Script( \!"^scriptName^\!", ^scriptDef^ )" )
) // end Parse statement
); // end Eval statement
) // end IF statement
); // continue For Loop until all scripts in the main data table have been copied
// At the completion of this script, you will have two data tables open with exactly the same name.
//
// The first table is the "main" table that contains the old data and all the source scripts.
// When you attempt to close this table you will NOT be prompted to "save" the table since we made
// no changes to it. The "main" table must be closed prior to closing and saving the "updated" table since
// we are going to save the "updated" table in the same location with the same name as the original "main"
// table since we are "replacing" the old table with the update version.
//
// The second table is the "updated" table which we created with the above script.
// This table has been loaded with the "updated" data file found in the "Source" script. It now also
// contains all of the scripts that were contained in the "main" data table for continued use with the
// updated source data. You will note that is has exactly the same table name as the "main" table, but if you
// inspect the rows of data you will find the only difference between the two table is that the "updated" table
// contains the additional rows of data from the updated source data file.
//
// The objective is to close the "main" table which should not prompt for a save, then close the "updated" table
// save it at the prompt over the original "main" table. When closing the "updated" table, you do have the option
// save it to any location you desire with any name you desire. My goal for creating this script was to replace
// the original table with the updated table.
//
// I will note here that I assumed I could not add the close of the main table and the save
// of the updated table to this script since by closing the main table (which must be done first)
// I would be closing the table in which this executing script is located. As such I assume the close action
// would stop the script.Re: JMP データテーブルの更新わかりました、
素早いご回答ありがとうございます。 私の問題は、提供していただいたサンプルの概念とは少し異なりますが、大幅に前進するために必要な洞察を私に与えてくれました。
上記のソリューションでは、新しいデータファイルの完全な内容を古いデータファイルに追加できるようになりましたが、私の問題は、新しいファイルには単に追加のデータ行が含まれているだけであるという点で、更新されたデータのレターバージョンへの「移動」に関連しています最初。 これは、2 つの別々のデータセットの接続や相関の問題ではありません。
あなたのサンプルは、元のテーブル(実際には元のデータと同じ名前と場所の新しい/更新されたソースデータファイルを指している)で「ソース」スクリプトを実行すると、新しいデータテーブルを取得することを理解させてくれました。 「ソース」スクリプトのみが存在します。 希望どおりに現在/更新されたデータを含む新しいテーブルができたものの、他のスクリプトは何もなかったとき、私は途方に暮れました。
サンプルでは、「スクリプトを古いテーブルから新しいテーブルにコピーします」ということでデータのマージを終了しました。
電球の瞬間...それができますか?
そこで、フォーラムを検索すると、スクリプトを 1 つのテーブルにリストし、それらを別のテーブルに挿入する例がいくつか見つかりました。 ある時点で、他のディスカッションにリンクする方法を見つけて、このような参照を示すことができるようにするつもりですが、今のところ、サンプルのコードは次のとおりです。
単一のスクリプトの場合:
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
scriptName = "Oneway";
scriptDef = dt << get table variable( scriptName );
dt2 = New Table( "little class" );
Eval(
Parse(
Eval Insert(
"
dt2 << New Script( \!"^scriptName^\!", ^scriptDef^ )
"
)
)
);
テーブル内のすべてのスクリプトの場合:
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt2 = New Table( "little class" );
Wait( 3 );
lstScriptNames = dt << Get Table Script Names;
Wait( 3 );
j = N Items( lstScriptNames );
For( i = 1, i <= N Items( lstScriptNames ), i++,
// scriptName = lstScriptNames;
scriptName = lstScriptNames( i );
scriptDef = dt << get table variable( scriptName );
Eval(
Parse(
Eval Insert( "dt2 << New Script( \!"^scriptName^\!", ^scriptDef^ )" )
)
);
);
ここで、「ソース」スクリプトのコピーを作成し、テーブルの割り当てを dt 変数に追加してから、ループを含む open コマンドに従ってすべてのスクリプトをコピーしようとしました。 scriptName と scriptDef の値を取得して正しくロードできませんでした。 scriptName は現在のテーブルに正しいスクリプトのリストをロードしているように見えますが、scriptDef 呼び出しは定義を取り込みません。
したがって、私は手動で単一コピーを繰り返して各テスト スクリプトを手動で追加しましたが、これは見事に機能しました。 私の結果のコードは次のとおりです。
dtCurrent = Current Data Table();
dtUpdate = Open(
"Z:\JMP Data Analysis\SLOC Metrics\Data Update Testing\Project_Metrics.xlsx",
Worksheets( "Code_Change_Metrics" ),
Use for all sheets( 1 ),
Concatenate Worksheets( 0 ),
Create Concatenation Column( 0 ),
Worksheet Settings(
1,
Has Column Headers( 1 ),
Number of Rows in Headers( 1 ),
Headers Start on Row( 1 ),
Data Starts on Row( 2 ),
Data Starts on Column( 1 ),
Data Ends on Row( 0 ),
Data Ends on Column( 0 ),
Replicated Spanned Rows( 1 ),
Replicated Spanned Headers( 0 ),
Suppress Hidden Rows( 1 ),
Suppress Hidden Columns( 1 ),
Suppress Empty Columns( 1 ),
Treat as Hierarchy( 0 ),
Multiple Series Stack( 0 ),
Import Cell Colors( 0 ),
Limit Column Detect( 0 ),
Column Separator String( "-" )
)
);
scriptName = "Mod vs Unmod Code Change Sample";
scriptDef = dtCurrent << get table variable( scriptName );
Eval(
Parse(
Eval Insert(
"
dtUpdate << New Script( \!"^scriptName^\!", ^scriptDef^ )
"
)
)
);
scriptName = "Individual & Moving Range chart of % Code Change";
scriptDef = dtCurrent << get table variable( scriptName );
Eval(
Parse(
Eval Insert(
"
dtUpdate << New Script( \!"^scriptName^\!", ^scriptDef^ )
"
)
)
);
scriptName = "Total Lines vs. Asset / Code Analyzed";
scriptDef = dtCurrent << get table variable( scriptName );
Eval(
Parse(
Eval Insert(
"
dtUpdate << New Script( \!"^scriptName^\!", ^scriptDef^ )
"
)
)
);
scriptName = "% Code Change vs. Asset / Code Analyzed";
scriptDef = dtCurrent << get table variable( scriptName );
Eval(
Parse(
Eval Insert(
"
dtUpdate << New Script( \!"^scriptName^\!", ^scriptDef^ )
"
)
)
);
scriptName = "UpdateDataTable";
scriptDef = dtCurrent << get table variable( scriptName );
Eval(
Parse(
Eval Insert(
"
dtUpdate << New Script( \!"^scriptName^\!", ^scriptDef^ )
"
)
)
);
scriptName = "TestingTableUpdateScript";
scriptDef = dtCurrent << get table variable( scriptName );
Eval(
Parse(
Eval Insert(
"
dtUpdate << New Script( \!"^scriptName^\!", ^scriptDef^ )
"
)
)
);
scriptName = "CopySingleScriptFromOldTable";
scriptDef = dtCurrent << get table variable( scriptName );
Eval(
Parse(
Eval Insert(
"
dtUpdate << New Script( \!"^scriptName^\!", ^scriptDef^ )
"
)
)
);
scriptName = "CopyAllScriptsFromOldTable";
scriptDef = dtCurrent << get table variable( scriptName );
Eval(
Parse(
Eval Insert(
"
dtUpdate << New Script( \!"^scriptName^\!", ^scriptDef^ )
"
)
)
);
元の JMP テーブル ファイル (ソース データ ファイルの最新バージョンで作成されたファイル) を開いた状態で、このスクリプトを実行して、更新されたソース データ ファイルから新しいテーブルを作成し、すべてのスクリプトを新しいテーブルにコピーします。 次に、2 つの JMP テーブルを開いて、両方とも同じタイトル、両方とも同じスクリプトを使用しますが、1 つは古いデータを持ち、もう 1 つは新しいデータ (より多くのデータ) を持ちます。 ここで、古いテーブルを閉じて、その上の同じ場所に新しいテーブルを保存します。
ブーム! 実行可能なすべてのスクリプトを含む更新されたデータ。 ファイルの場所と名前は同じなので、必要に応じて週次または月次レポートの更新ごとにプロセスを繰り返すことができます。
実際のコードでスクリプト名を管理することなく、他のデータセットで同じスクリプトを使用できるように、すべてのスクリプトを動的にロードするための自動ループを取得したいと考えています。 現時点では、ループの問題を解決するまで手動バージョンを進めています。
迅速な対応と、最終的に解決策につながるサンプルを提供していただき、本当にありがとうございました。
Re: JMP データテーブルの更新JMP 13 を使用しているため、次のようにすることもできます。
NamesDefaultToHere(1);
// Make some 'new data' (imported from Excel)
dt2 = New Table( "New Data",
Add Rows( 10 ),
New Column( "x",
Numeric,
"Continuous",
Formula( Random Normal() )
),
New Column( "y",
Numeric,
"Continuous",
Formula( Random Integer(10, 20 ) )
)
);
dt2 << runFormulas;
Column(dt2, "x") << deleteFormula;
Column(dt2, "y") << deleteFormula;
// Make some 'old data' containing a saved script (stored as a JMP table)
dt1 = New Table( "Old Data",
Add Rows( 20 ),
New Script(
"y vs. x",
Graph Builder(
Variables( X( :x ), Y( :y ) ),
Elements( Points( X, Y, Legend( 5 ) ), Smoother( X, Y, Legend( 6 ) ) )
)
),
New Column( "x",
Numeric,
"Continuous",
Formula( Random Normal() )
),
New Column( "y",
Numeric,
"Continuous",
Formula( Random Integer(1, 10 ) )
)
);
dt1 << runFormulas;
Column(dt1, "x") << deleteFormula;
Column(dt1, "y") << deleteFormula;
// Update dt1 from dt2 using data table subscripting (requires JMP 13 or later)
Wait(3);
firstNewRow = NRows(dt1) + 1;
dt1 << addRows(NRows(dt2));
dt1[firstNewRow::NRow(dt1), 0] = dt2[0, 0];
Re: JMP データテーブルの更新デイブ、
特定のニーズによっては、Update プラットフォームがソリューションとなる場合があります。 ただし、JSL を使用すると、必要な操作をほぼすべて行うことができ、最終的には、再構成されたデータ テーブルに元のスクリプトが残るようになります。 これは、埋め込みスクリプトを元のテーブルから新しく作成したテーブルにコピーする、非常に単純なコードです。
Re: JMP データテーブルの更新これは古いスレッドですが、私が直面している問題に関連する唯一のスレッドのようです。
私は新しい JMP を使用しており、13.1 を持っています。 JMP の使用方法を学んでいるので、メトリクスの追跡とレポートに使用するデータセットをインポートしています。Excel ファイルをインポートし、分析を実行するためのスクリプトを作成できます。よく働く!
さて問題は:
この取り組みのソース データは、毎週から毎月更新されます。私の目標は、JMP テーブルを最新の Excel データに更新した後で、データに対して同じ初期分析を毎月実行できるように JMP をセットアップすることです。「ソース」スクリプトを使用してみましたが、元の JMP テーブルに保存したスクリプトを含まない新しい JMP テーブルが作成されるだけです。
「update」関数について読みましたが、これはテーブル内のデータが変更された場合にテーブルを更新する関数のようです。「更新」機能は、ソース データ セットに「再同期」または「インポート」して、時間の経過とともに更新/増加する唯一の利用可能な方法ですか?
ご協力をいただければ幸いです。
デイブ
Re: JMP データテーブルの更新このスレッドの最初の 2 つの投稿を見ると、JMP のテーブル更新機能について言及しているとは思いませんでした。 実際、私は最近 Update をよく使用していますが、これが JMP データ テーブル以外のもので機能するという印象は一度もありませんでした。実際には、(データ) テーブル ツールバーまたは (データ) テーブル メニューからアクセスします。 また、あなたの元の投稿には、あなたが何をしていたかの詳細な説明がなかったので、誰も反応しなかったのです。
Excel の新しいデータで JMP のテーブルを定期的に更新する状況では、Excel ワークブックから JMP にデータをインポートし、保持されているデータ テーブルを Excel ワークブックから作成されたデータ テーブルで更新するスクリプトを作成します。 そうは言っても、外部データ ソースとの結合 (Join、Update、Concatenate 関数が実行する機能) を実行できる機能は、追加すると興味深い機能になる可能性があります。 JMP には SQL サポートを備えた外部データベースでのこの機能がすでに備わっていますが、それは SQL データベースでのみ機能します。 Excel はデータベースではなく、ましてや SQL データベースでもないため、この場合 SQL クエリを利用することはできません。 JMP には、データ結合のために Excel ワークブック内のワークシートに直接クエリを実行するワンクリック機能が現在ありません。
Re: JMP データテーブルの更新saitcopuroglu さん、結局 JMP テクニカル サポートに電話しました。結局のところ、上で概説した「回避策」が、Excel スプレッドシートから更新する状況に対する現時点での唯一の解決策であることがわかりました。更新関数は、ある JMP データ テーブルから別の JMP データ テーブルに更新するために設計されていると聞きました。ただし、この問題は JMP の将来のバージョンのアイデアとして提出される予定です。
Re: JMP データテーブルの更新理解を深めるために Excel/jmp/jsl ファイルを提供していただけますか? 私も興味があります
Re: JMP データテーブルの更新誰か……誰か……誰か?
更新機能を試してみました。JMP は、データ テーブルに「ソース」として保存されているスクリプトを上書きするようです。初めて更新すると、すべてが正常に動作します。ただし、更新が呼び出されると、「ソース」として保存されたスクリプトは、JMP によってすぐに新しいテーブルから元のテーブルを更新するスクリプトで上書きされます。次回「ソース」スクリプトから更新しようとしても、何も起こりません。そこで、私はこれを試しました。データテーブルの「Source」スクリプトの名前を「Update」に変更し、再試行しました。今回は、「Update」スクリプトは変更されませんでしたが、「Source」という新しいスクリプトがデータテーブルに追加されました。この「回避策」は明らかに効率的ではないため、必要ないはずです。