Seelect where Calculation from 2 entries
Hello i ned the difference from 2 entries in a table (Hour meter)
the last of the entry i get:
let myreg := Registration;
last((select 'Flt Hrs' where Luftfahrzeuge.Registration = myreg) order by Datum).TSN
but for calculation i need also the secon last of the same Registy... how can i solve this?
Table 'Flt Hrs'

regards Alex
6 replies
-
I'm not sure what you are asking. Your code finds the last record of a dataset then gets the data from the TSN field. Are you asking how to get other data from the same field?
-
Try:
let myreg := Registration; let sel := (select 'Flt Hrs' where Luftfahrzeuge.Registration = myreg) order by Datum) item(r, cnt(sel) - 2).TSN -
Thanks it work like this:
let myreg := Registration;
let sel := ((select 'Flt Hrs' where Luftfahrzeuge.Registration = myreg) order by Datum);
item((select 'Flt Hrs' where Luftfahrzeuge.Registration = myreg) order by Datum, cnt(sel) - 2).TSN -
The Difference between this 2 Entris wok then like this:

Thanks
-
Also you can slice the last two directly.
let myReg := Registration; let lastTwo := slice((select 'Flt Hrs' where Luftfahrzeuge.Registration = myReg) order by -Datum),0,2).TSN; item(lastTwo, 0) - item(lastTwo, 1)
Content aside
- Status Answered
- 9 days agoLast active
- 6Replies
- 54Views
-
5
Following
