在不打開文件的情況下訪問.jmp文件的行/列計數和註釋至少可以在Windows上通過JMP Open文件訪問此信息:

想知道是否可以通過腳本訪問這些文件而無需打開JMP數據表(打開數據文件選項)?
列名可以通過以下方式訪問
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp", "Column Names Only");
數據表腳本編寫回复:在不打開文件的情況下訪問.jmp文件的行/列數和註釋你好@jthi ,
我不知道如何從JMP的打開的窗口對話框中獲取該信息,但是您可以執行以下操作:
Names Default to Here(1);
dt=open("$SAMPLE_DATA/Big Class.jmp", Invisible);
Show(Nrows(dt));
Show(NCols(dt));
Close(dt);它應該在“日誌”窗口或“腳本”窗口的嵌入式日誌中返回以下內容:
N行(dt)= 40;
N Cols(dt)= 5;
open命令中的“ Invisible”不會使數據表顯示在最前面,而是將其隱藏在後台。 您甚至可以執行Show Properties(dt)命令,並在數據表上獲取更詳盡的信息列表。
我知道這並不是您想要的,但我認為它可以勝任。
DS
回复:在不打開文件的情況下訪問.jmp文件的行/列數和註釋我建議指定“私有”而不是“不可見”。 由於不必創建顯示對象,因此它不會使JMP如此困難。回复:在不打開文件的情況下訪問.jmp文件的行/列數和註釋JMP在“打開數據文件”菜單中顯示它的方式更快(也許...)。 我有一些桌子很寬,有60列,非常高,約有1500萬行。 打開這些文件相當慢。 我可以通過僅將其作為列名打開來獲取列數,並且可以通過僅將datatable僅作為單列而打開所有行來獲取行數,但是我認為這仍然會更慢。 當然,JMP可能在幕後做了類似的事情嗎?
我也許可以實現這樣的事情:
Names Default To Here(1);
dtPath = "$SAMPLE_DATA/Probe.jmp";
//dtPath = "$SAMPLE_DATA/Alcohol.jmp"; //table with notes
colNames = Open(dtPath, "Column Names Only");
colCount = N Items(colNames);
dt_temp = Open(dtPath, Select Columns([1]), Private);
notesTableVar = dt_temp << Get Table Variable("Notes");
rowCount = N Rows(dt_temp);
dt_temp = Empty();
Show(colCount, rowCount, notesTableVar);
//Show(colNames);因為發現峰會正在進行中,所以也許我跳入了開發人員見面會的其中一個會議,並在那裡也提出了這個問題。
回复:在不打開文件的情況下訪問.jmp文件的行/列計數和註釋我今天在發現峰會上參加了“與開發人員見面”會議,並對此進行了詢問。 看來,像我之前發布的解決方案(獲取列名稱,N Items()用於列計數,打開數據表並將一列作為私有以及N Rows()用於行計數)的解決方案目前是最快的方法。 他們記下了筆記,因此也許將來甚至不打開私有數據表就可能成為可能,否則JMP將提供執行此操作的功能。
以下是函數格式的腳本。 他們建議為dt_temp添加Close。 該腳本可能需要Wait(0);在這里和那裡,但是由於沒有它們,它確實起作用了,所以我沒有添加任何東西。
Names Default To Here(1);
//https://community.jmp.com/t5/Discussions/Accessing-jmp-file-row-col-count-and-notes-without-opening-file/td-p/366316
//Function to get column count, rowcount, table notes and column names to associative array
getTableInfo = function({path_to_table}, {Default Local},
//Check that file exists
If(!File Exists(path_to_table),
return(Associative Array({"error"}, {"File not found"}));
);
//Initialize associative array
retVal = Associative Array(
{"name", "rowCount", "columnCount", "notes", "columnNames"},
{"", 0, 0, "", {}}
);
//Open datatable as columns only list
colNames = Open(path_to_table, "Column Names Only");
//Check that table has atleast one column
If(N Items(colNames) > 0,
retVal["columnNames"] = colNames;
retVal["columnCount"] = N Items(colNames);
dt_temp = Open(path_to_table, Select Columns([1]), Private);
retVal["name"] = dt_temp << get name();
retVal["rowCount"] = N Rows(dt_temp);
);
//Get notes from "Notes" table variable
retVal["notes"] = dt_temp << Get Table Variable("Notes");
Close(dt_temp, no save);
return(retVal);
);
//Examples with tables from $SAMPLE_DATA
aa_probe = getTableInfo("$SAMPLE_DATA/Probe.jmp");
Show(aa_probe["name"],aa_probe["rowCount"], aa_probe["columnCount"], aa_probe["notes"]);
Show(getTableInfo("$SAMPLE_DATA/Alcohol.jmp"));
Show(getTableInfo("$SAMPLE_DATA/Alcohol.jmpmissing"));