filter records from a reference table to calculate a value to be stored on a fiend on parent table

Ninox Profile

Hello, I have this two referenced tables, the first one called 'Registro' and a child called 'Operacion'. I need to filter on the 'Operacion' table all the "Dia" registries on the field -Clase- and then calculate de difference from the first and last value of the field -Horometro-; then put this resulted value on the correspondent field called -H_Dia- on the table 'Registro'.

As example (see attached screen capture) on the table 'Operacion' if I filter on the field -Clase- all records "Dia", then  the field -Horometro- will show only the values 3.000,0 ; 3010,0 and 3.020,0 so then I will be able to calculate the difference between first and last wich is 20 (3.020,0 - 3.000,0) and finally put this result of 20 on the field called H_Dia on the table 'Registro'

Can anyone help me with the required script to be used on the field -H_Dia- on the table 'Registro' to accomplish the above

Captura de pantalla 2018-10-18 a la(s) 12.23.53 a. m.

 

Ninox Profile

Well after playing around I solve the above with this formula:

last(Operacion[Clase = "Noche"].Horometro) - first(Operacion[Clase = "Noche"].Horometro)

 

Reply