新增前導字元的腳本(在本例中為前導零)讓列對其自身進行操作的語法是什麼?
這是我能想到的最好的方法,但它不起作用。
dt = current data table();
column(dt, "Architecture") << Set Each Value( Repeat("0",3-Length(Char("Architecture")))||Char("Architecture"));
Column Architecture 的值有 1、2、123、XXX 等。長度不是標準的。
想要一個將在表上運行並隱藏列以將長度標準化為 3 並添加任何前導零的腳本。
結果值為 001、002、123、XXX 等。
看到這個帖子,差不多了。
https://community.jmp.com/t5/Discussions/How-to-represent-numeric-value-quot-1-quot-as-quot-001-quot/td-p/10972
回覆:新增前導字元的腳本(在本例中為前導零)謝謝你們倆。該軟體很棒,用戶社群也更好!
回覆:新增前導字元的腳本(在本例中為前導零)JSL 可以忽略列名稱中的空格。但它不能原諒特殊字符。以下語句是對列的等效引用。
dt:Architecture Digest
column(dt, "Architecture Digest")<BR />
對於特殊字符,您可以使用柱子()或者:姓名()
// Column with special characters, ABC=DEF?
column(dt, "ABC=DEF?")
:Name("ABC=DEF?")回覆:新增前導字元的腳本(在本例中為前導零)如果列名中有空格怎麼辦?
太感謝了!回覆:新增前導字元的腳本(在本例中為前導零)你快到了。 使用範圍字元(單一冒號)來確保 JSL 理解它是一個變數(即列),而不是字串。
dt = Current Data Table();
dt:Architecture << Set Each Value(Repeat("0", 3 - Length(dt:Architecture)) || dt:Architecture);回覆:新增前導字元的腳本(在本例中為前導零)您需要循環遍歷每一行並應用更改:
Names Default To Here( 1 );
dt = Current Data Table();
For Each Row(
dt:Architecture = Repeat( "0", 3 - Length( Char( dt:Architecture ) ) ) ||
Char( dt:Architecture )
);