檢查一個表的行中的數據,以查看它們是否在另一個表的列中第一張表:

第二表:

我試圖檢查第一個表的第四行中的最大值與第二個表中的相鄰列。
到目前為止,我已從第一個表中提取列名和行值:
dt1 = Open();
namesForCols = dt1 << get column names("String");
show(namesForCols);
row4 = dt1[4, 0];
show(row4);
close(dt1,nosave);如何檢查列表row4中的值是否存在於第二個表的列中?謝謝。
Re:檢查一個表的行中的數據,看它們是否在另一個表的列中這是一個簡單的腳本,可以回答您的問題。
Names Default To Here( 1 );
dt1 = Data Table( "Table 1" );
dt2 = Data Table( "Table 2" );
// Get the numeric columns
colNamesList = dt1 << get column names( numeric, string );
// Add a new row of data, that will tell how many rows in
// Table 2 have the maximumn values from row 4
dt1 << add rows( 1 );
dt1:Column 1[N Rows( dt1 )] = "Number of Rows Found";
// Loop across the numeric columns in table 1
For( i = 1, i <= N Items( colNamesList ), i++,
// If the column in table 2 exists, process
If( Try( Column( dt2, colNamesList[i] ) << get name, "" ) != "",
// Get the value from table 1 to compare with in table 2
compareValue = Column( dt1, colNamesList[i] )[4];
// Find the number of rows in table 2 that match the
// value in row 4 of table 1 and save it into row 5
// of table 1
Column( dt1, ColNamesList[i] )[N Rows( dt1 )] =
N Rows(
dt2 << get rows where(
As Column( dt2, colNamesList[i] ) == compareValue
)
);
)
);