嗨HSS
我認為需要做 3 個步驟才能滿足您的需求。
1. 匯總您的數據表以進行映射。 索引是“傳感器”,值是“最大(入口),最大(返回)”。
//可以使用下面的JSL來匯總一個新的數據表
Data Table( "Data" ) << Summary(
Group( :Sensor ),
Max( :Occurrence ),
Subgroup( :Name( "Sub-Sensor" ) ),
Freq( "None" ),
Weight( "None" ),
statistics column name format( "column" )
);
2. 通過 if 或 match 輸入您的條件。 在這裡,我使用了 If 並在匯總數據表中創建了一個新列。
If(
:Name( "Occurrence, Inlet" ) >= 2 & :Name( "Occurrence, Return" ) >= 2, "Both",
:Name( "Occurrence, Inlet" ) >= 2 & :Name( "Occurrence, Return" ) < 2, "Inlet",
:Name( "Occurrence, Inlet" ) < 2 & :Name( "Occurrence, Return" ) >= 2, "Return",
"Empty"
);
3.通過“傳感器”將兩個數據表連接在一起,並確保列“結果”包含。 然後使用條件 if 使其成為現實。
// 將匯總數據表連接到原始數據表
Data Table( "Data" ) << Join(
With( Data Table( "Data By (Sensor)" ) ),
Select(
:ID,
:Sensor,
:Name( "Sub-Sensor" ),
:Occurrence,
:Required Column,
:Name( "Required Column -Cause" )
),
SelectWith( :Result ),
By Matching Columns( :Sensor = :Sensor ),
Drop multiples( 0, 0 ),
Include Nonmatches( 0, 0 ),
Preserve main table order( 1 )
);
// 在“必填列-原因”列中添加公式,如下所示
If(
:Name( "Sub-Sensor" ) == "Inlet" & :Result == "Inlet", "Inlet",
:Name( "Sub-Sensor" ) == "Return" & :Result == "Return", "Return",
:Name( "Sub-Sensor" ) == "Inlet" | :Name( "Sub-Sensor" ) == "Return" & :Result == "Both", "Both",
""
);
大家好,
新年快樂,
我被困在另一個地方,有想法/邏輯,但無法輸入正確的公式。 請參閱附圖進行說明。 樣本數據也附上。
有什麼幫助嗎?
非常感謝。