我不能帮您使用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->进行分配
我可以知道这件事吗?
谢谢。