How to get last hourmeter reading from a mach...

How to get last hourmeter reading from a machine?

Have a table with columns A - timestamp B - placa (machine code) C - hourmeter D - last hourmeter

When inserting a new entry, the hourmeter can´t be smaller than the last hourmeter inserted.

So I need to get the last hourmeter, and if it’s higher than the one inserted, it will block the insertion of the new one (needs to type a new number)

tried this function at Last Hourmeter column LOOKUP(maxrow(app, timestamp), app, placa, hourmeter)

Got error message saying the result type was a number, when it expected a text.

What should I use in place?

0 5 343
5 REPLIES 5

[_THIS]>MAX(SELECT(TableName[HOURMETER],[PLACA]=[_THISROW].[PLACA]))

Thanks Aleksi, the formula works, but I would still like to SHOW to the operator what was the previous hourmeter.

And by using “MAX(SELECT(TableName[HOURMETER],[PLACA]=[_THISROW].[PLACA]))” on the “Last Hourmeter” column, I also get the message that the result (number) does not matches the expected type (text)

I find it funny that it’s result can´nt be shown and yet the same result is valid and used when comparing which one is larger, in your expression!

Is the Last Hourmeter’s column type a number? The error message is saying that the result is a number but your column is waiting for a text value.

Well… when I wrote this topic, and when I replied above, I checked 3 times and the column was a NUMBER type. I even changed on purpose to TEXT type just to be sure the inverse wouldn´t work (it did not)

Now I went there and changed again to number type… and it worked…

Good to hear it’s working now.

Top Labels in this Space