我不能幫您使用Tableau。
可能有效的JMP腳本如下:
Names Default to Here( 1 );
dt = Current Data Table();
dialog = New Window( "Select Columns", << Modal,
y col list = Col List Box(
All
),
H List Box(
Button Box( "OK",
y col = y col list << Get Selected;
),
Button Box( "Cancel" )
)
);
If( dialog["Button"] == -1,
Throw( "User cancelled" );
);
Show( y col );
If( N Items( y col ) > 0,
y expr = Expr( Y() );
For( i = 1, i <= N Items( y col ), i++,
Insert Into( y expr, Column( y col[i] ) );
);
Eval(
Substitute(
Expr( dt << Distribution( yyy) ),
Expr( yyy ), Name Expr( y expr )
)
);
);
嗨,馬克,非常感謝您的幫助。
我還面臨一個想問的問題。通常,我將需要處理一個使用以下腳本的表,並首先解碼序列號以獲取日期代碼/配置等。 由於某些原因,“ SerialNumber”名稱將更改為“電池序列號”或其他名稱。如果還可以讓用戶先選擇要“濛濛”的那一列,然後要求用戶選擇要進行分配的列。
dt = currentdatatable();
dt <<
Select duplicate rows( Match( :SerialNumber ) );
xx=dt<<GET selected="" rows="">0,
dt<<DELETE rows=""></DELETE></GET>
這個擴展的腳本應該向您展示如何繼續。它允許用戶在同一對話框中進行兩個選擇。
Names Default To Here( 1 );
dt = Current Data Table();
dialog = New Window( "Select Columns", << Modal,
Panel Box( "Column Selection",
Lineup Box( N Col( 2 ),
Text Box( "Select column for munging" ),
m col list = Col List Box( All ),
Text Box( "Select columns for distribution" ),
y col list = Col List Box( All )
)
),
H List Box(
Button Box( "OK",
m col = m col list << Get Selected;
y col = y col list << Get Selected;
),
Button Box( "Cancel" )
)
);
If( dialog["Button"] == -1,
Throw( "User cancelled" )
);
Show( m col, y col );
dt << Select Duplicate Rows( Match( :SerialNumber ) );
xx = dt << Get Selected Rows;
If( N Rows( xx ) > 0,
dt << Delete Dows
);
dt << New Column( "Date Code", Numeric, Continuous, Formula( Munger( :Name( "Serial Number" ), 4, 3 ) ) )
<< New Column( "Vendor", Numeric, Continuous, Formula( Munger( :Name( "Serial Number" ), 1, 3 ) ) )
<< New Column( “Config”, Numeric, Continuous, Formula( Munger( :Name( "Serial Number" ), 12, 5 ) ) );
If( N Items( y col ) > 0,
y expr = Expr( Y() );
For( i = 1, i <= N Items( y col ), i++,
Insert Into( y expr, Column( y col[i] ) )
);
Eval( Substitute( Expr( dt << Distribution( yyy ) ), Expr( yyy ), Name Expr( y expr ) ) );
);
在您提供的示例中,我沒有理由將列名更改為“電池序列號”。
大家好,我目前正在嘗試學習Tableau腳本,並希望重新發布一項功能。
要求用戶選擇1個或多個Cloumn->進行分配
我可以知道這件事嗎?
謝謝。