キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Get the free JMP Student Edition for qualified students and instructors at degree granting institutions.
言語を選択 翻訳バーを非表示
最初に公開されたスレッドを表示

スクリプトでカスタム日付形式を使用するJMP16

LukeFarrell
Level III

こんにちは、

 

日付が次のようにフォーマットされているデータテーブルに取り組んでいます:15/09/08/19:12。

/ /

/ <::> のデータテーブルエディターのカスタムフォーマット機能を使用してこれを変換できましたが、スクリプトを使用して変換する方法がわかりませんこれを機能させます。

 

以下はスクリプトの成果です。どんな助けでも大歓迎です。

よろしくお願いします、

ルーク

 

 

path = Get Default Directory(); 
dt = Pick File("Select .csv file with  data", path, {"Excel|csv;xlsx;xls", "JMP Files|jmp;jsl;jrn", "All Files|*"}, 1, 0, ""); 


Open(dt,
 columns(
  New Column( "; DateTime", Numeric, "Continuous", Format( "y/m/d h:m"),Input Format( "///<::>", 3 )),
  New Column( "Machine ID", Character, "Nominal" ),
  New Column( "Z/Xrmv_max", Numeric, "Continuous", Format( "Best", 12 ) ),
  New Column( "Z/Xrmv_min", Numeric, "Continuous", Format( "Best", 12 ) ),
  New Column( "Z/Xrmv_max-min", Numeric, "Continuous", Format( "Best", 12 ) ),
  New Column( "P/Xrmv_max", Numeric, "Continuous", Format( "Best", 12 ) ),
  New Column( "P/Xrmv_min", Numeric, "Continuous", Format( "Best", 12 ) ),
  New Column( "P/Xrmv_max-min", Numeric, "Continuous", Format( "Best", 12 ) )
 ),
 Import Settings(
  End Of Line( CRLF, CR, LF ),
  End Of Field( Comma, CSV( 1 ) ),
  Strip Quotes( 0 ),
  Use Apostrophe as Quotation Mark( 0 ),
  Use Regional Settings( 0 ),
  Scan Whole File( 1 ),
  Treat empty columns as numeric( 0 ),
  CompressNumericColumns( 0 ),
  CompressCharacterColumns( 0 ),
  CompressAllowListCheck( 0 ),
  Labels( 1 ),
  Column Names Start( 1 ),
  Data Starts( 2 ),
  Lines To Read( "All" ),
  Year Rule( "20xx" )
 )
);
JMPアナリティクスデータ表スクリプティングウィンドウズ

この投稿のオリジナルは 、English (US) で書かれており、ユーザビリティ向上のため自動翻訳機能を使用して表示しています。コメントを投稿すると、オリジナルの言語(English (US))やご指定の言語 でも表示されます。

1 件の受理された解決策

受理された解決策
jthi
Super User

Re: JMP16 Using Custom Date Formats In Scripts

I created quick test.csv with only couple of rows and used the option to directly modify it in the import platform:

jthi_0-1628784611221.png

 

Script:

Open(
	"$DOCUMENTS/JMP/test.csv",
	columns(
		New Column("time",
			Numeric,
			"Continuous",
			Format("Format Pattern", "<YY>/<MM>/<DD>/<hh24><::><mm>", 14),
			Input Format("Format Pattern", "<YY>/<MM>/<DD>/<hh24><::><mm>")
		)
	),
	Import Settings(
		End Of Line(CRLF, CR, LF),
		End Of Field(Comma, CSV(0)),
		Strip Quotes(1),
		Use Apostrophe as Quotation Mark(0),
		Use Regional Settings(0),
		Scan Whole File(1),
		Treat empty columns as numeric(0),
		CompressNumericColumns(0),
		CompressCharacterColumns(0),
		CompressAllowListCheck(0),
		Labels(1),
		Column Names Start(1),
		Data Starts(2),
		Lines To Read("All"),
		Year Rule("20xx")
	)
)

So maybe the "result" format must also be done with Format Pattern?

-Jarmo

元の投稿で解決策を見る

6件の返信6
jthi
Super User

Re:スクリプトでカスタム日付形式を使用するJMP16

フォーマットパターンを使用する場合の構文は少し異なります。 次のようなものを試してください:

Format("y/m/d h:m"),
Input Format("Format Pattern", "///<::>")表の例New Table("Untitled",
 Add Rows(1),
 New Column("Column 1",
  Numeric,
  "Nominal",
  Format("y/m/d h:m"),
  Input Format("Format Pattern", "///<::>"),
  Set Selected,
  Set Values([3061825920]),
  Set Display Width(89)
 )
);

この投稿のオリジナルは 、English (US) で書かれており、ユーザビリティ向上のため自動翻訳機能を使用して表示しています。コメントを投稿すると、オリジナルの言語(English (US))やご指定の言語 でも表示されます。

LukeFarrell
Level III

Re:スクリプトでカスタム日付形式を使用するJMP16

ありがとうございました@jthi

 

私はまだ列がまだnullの結果を出しているという問題を抱えています:

undefined

列は、手動で実行する場合と同じように、目的の形式に変更されます。 名前が「;スキーマ定義」であるために元の列名が変更されていないことが原因である可能性がありますか?

 

再度、感謝します。

この投稿のオリジナルは 、English (US) で書かれており、ユーザビリティ向上のため自動翻訳機能を使用して表示しています。コメントを投稿すると、オリジナルの言語(English (US))やご指定の言語 でも表示されます。

jthi
Super User

Re:スクリプトでカスタム日付形式を使用するJMP16

最初にキャラクターとしてインポートしようとすると、どのように見えますか? 空のセルだけ?

 

New Column( "; DateTime", Character, "Nominal),

 

 

この投稿のオリジナルは 、English (US) で書かれており、ユーザビリティ向上のため自動翻訳機能を使用して表示しています。コメントを投稿すると、オリジナルの言語(English (US))やご指定の言語 でも表示されます。

LukeFarrell
Level III

Re: JMP16 Using Custom Date Formats In Scripts

If taken as Character we get the following:

LukeFarrell_0-1628784004593.png

Also, in regards to my previous reply, I edited the original csv and removing the ";" does not change the issue. 

 

~ Luke :)
jthi
Super User

Re: JMP16 Using Custom Date Formats In Scripts

I created quick test.csv with only couple of rows and used the option to directly modify it in the import platform:

jthi_0-1628784611221.png

 

Script:

Open(
	"$DOCUMENTS/JMP/test.csv",
	columns(
		New Column("time",
			Numeric,
			"Continuous",
			Format("Format Pattern", "<YY>/<MM>/<DD>/<hh24><::><mm>", 14),
			Input Format("Format Pattern", "<YY>/<MM>/<DD>/<hh24><::><mm>")
		)
	),
	Import Settings(
		End Of Line(CRLF, CR, LF),
		End Of Field(Comma, CSV(0)),
		Strip Quotes(1),
		Use Apostrophe as Quotation Mark(0),
		Use Regional Settings(0),
		Scan Whole File(1),
		Treat empty columns as numeric(0),
		CompressNumericColumns(0),
		CompressCharacterColumns(0),
		CompressAllowListCheck(0),
		Labels(1),
		Column Names Start(1),
		Data Starts(2),
		Lines To Read("All"),
		Year Rule("20xx")
	)
)

So maybe the "result" format must also be done with Format Pattern?

-Jarmo
LukeFarrell
Level III

Re: JMP16 Using Custom Date Formats In Scripts

Hi @jthi , thank you so much! That has worked and has fixed the issue!

~ Luke :)