大家好,
對於每個專案組,我需要根據 Param 列中「1」的行位置迭代地從 Param2 列中選擇資料(見下圖)。 我怎樣才能做到這一點?

此致
這是重新建立範例資料表的小腳本,然後進行選擇

Names Default To Here( 1 );
// recreate the example data table
dt = New Table( "Example",
Add Rows( 14 ),
New Column( "Item",
Character,
"Nominal",
Set Values( {"A", "A", "A", "A", "A", "B", "B", "B", "B", "B", "C", "C", "C", "C"} )
),
New Column( "Param",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [0.8, 1, 0.9, 1.1, 1.2, 0.9, 0.8, 1, 0.7, 0.8, 0.5, 1, 0.9, 1.1] ),
Set Display Width( 46 )
),
New Column( "Param2",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [2.1, 2, 2.3, 2.4, 2.5, 3.3, 3.2, 3.4, 3, 3.7, 2.5, 5.5, 5.4, 5.6] )
)
);
// select the required rows
Summarize( dt, group = by( :Item ) );
dt << clear select;
For( i = 1, i <= N Items( group ), i++,
theRow = (dt << get rows where( :Item == group[i] & :Param == 1 ))[1];
dt << select where( :Item == group[i] & Row() >= theRow, current selection( "extend" ) );
);