从不同表中选择数据我有两个数据表,dt1和dt2,我试图使用函数“For Each Row”来解析dt1,然后在该循环中评估dt2中的相应数据。为了确保一行代码是从右表中获取数据,是否必须在其前面加上“当前数据表(dt1 / dt2)”或发送运算符“<<”?让我提供一个示例代码块,并允许您根据需要进行调整。
row_count = 1;
For Each Row (
item_of_interest = dt1[row_count,1]; //Grab the value in the first column
dt2 << If ( Contains ( dt2[0,1], item_of_interest), //Look through column 1 in dt2 for that specified value in dt1
Write("Yes\!n"),
Write("No\!n");
);
row_count++;
);谢谢!
回复:从不同的表中选择数据这是我通常如何做你正在寻找的语法:
Names default to here(1);
dt1=data table(?????);
dt2=data table(?????);
For( i = 1, i <= N Rows( dt1 ), i++,
item_of_interest = Column( dt1, 1 )[i]; //Grab the value in the first column
theRows = dt2 << get rows where( Column( dt1, 1 ) == item_of_interest );
If( N Rows( theRows ) > 0, //Look through column 1 in dt2 for that specified value in dt1
Write( "Yes\!n" )
,
Write( "No\!n" )
);
);