조건이 있는 테이블의 목록 값을 입력합니다.나는이 테이블이 있습니다 :
똥 | 가치
0 | 1638
1 | 618
2 | 486
3 | 9418
0 | 654
1 | 791
2 | 1398
3 | 4836
...
그리고 나는 dut가 0인 모든 값을 목록에 넣고 싶습니다.
어떤 구문이 사용되었습니까?
데이터 테이블Re: 조건이 있는 테이블의 목록 값을 입력합니다.내가 선호하는 방법은 데이터 테이블 첨자 Loc을 사용하지만 이를 수행하는 다른 많은 방법이 있습니다.
Names Default To Here(1);
dt = New Table("Untitled",
Add Rows(8),
New Column("dut", Numeric, "Continuous", Format("Best", 12), Set Values([0, 1, 2, 3, 0, 1, 2, 3])),
New Column("value", Numeric, "Continuous", Format("Best", 12), Set Values([1638, 618, 486, 9418, 654, 791, 1398, 4836]))
);
zero_rows = Loc(dt[0, "dut"], 0);
list_of_values = dt[zero_rows, "value"]; // and you can convert this to list with As List();
Re: 조건이 있는 테이블의 목록 값을 입력합니다.다음은 동일한 솔루션에 대한 또 다른 접근 방식입니다.
Names Default To Here(1);
dt = New Table("Untitled",
Add Rows(8),
New Column("dut", Numeric, "Continuous", Format("Best", 12), Set Values([0, 1, 2, 3, 0, 1, 2, 3])),
New Column("value", Numeric, "Continuous", Format("Best", 12), Set Values([1638, 618, 486, 9418, 654, 791, 1398, 4836]))
);
theList = As List( :value[dt << get rows where( :dut == 0 )] );
Show( theList );
theList = as list(:value[dt<<get rows where(:dut == 0)])
/*:
{1638, 654}