使用“获取行”我需要使用 Get RowsWhere 来获取值略低于特定值的行。
换句话说:
我有一个约会A
我有一张有日期的桌子。 我需要获取日期最新但小于日期 A 的行
例子:
我有一个人去世的约会。
当有人登录他的帐户时,我有一个包含所有事件的表。 他去世之前和之后都有日期。
我需要找到他去世前登录的最新日期。
大致如下:
lastSelfLogin = dt<<Get Rows Where(:loginDate < deathDate & /*here goes condition that this date needs to be the last*/);
有任何想法吗?
谢谢!
回复:使用“获取行”我很高兴您找到了解决方案
回复:使用“获取行”吉姆,
谢谢回复。
我举的例子有点不正确。您的脚本确实会给出自我登录的最新日期。 但是,当发生这种情况时,我需要行数来从相邻列中查找其他关联值。
解决方案如下:
//Finding indices for all the logins for current person before death date
rowPerson=dt2 << Get Rows Where(:Person==thisPerson & :"DeathDate" < thisDate);
//Finding index for the latest login date
rowLatestLoginDate=Loc(loggedOn[rowPerson] == Max(loggedOn[rowPerson]));
//Then later I can access other columns. For instance, weather when person logged in himself for the last time
lastWeather=currentWeather[rowPerson[rowLatestLoginDate]];
回复:使用“获取行”这将做到这一点:
lastSelfLogin = Max(dt<<获取行Where(:loginDate < DeathDate));