使用“獲取行”我需要使用 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));