Use the last data enterend in a table

Hey, I am new to appsheet and I would like to know how to do the following:

I am collecting vehicle mileage from persons on the field, so I have decided to use two tables for this. One table contains the start data (driver names, vehicle number, location, and mileage) and the other table holds the end data (driver names, vehicle number, location, and mileage) 

Now, I would like to use the end mileage to be equal to the start mileage for that vehicle number but I don't want the values to show as a suggestion but more so as an error message 

Solved Solved
0 6 218
1 ACCEPTED SOLUTION

Hello @Sophtee, Instead of 2 tables you could add another column to that setup called "Type", and that can be either "Start" or "End", so then the start mileage would be equal to this:

INDEX(SORT(SELECT(Vehicle mileage[mileage],[vehicleREF]=[_THISROW].[vehicleREF]),TRUE),1)

You can use that value to display it in any way you want, as I am not really sure what you mean by "error message", maybe you mean that the end milage should be the same as the next start mileage? In that case it would be used in a valid_if()

View solution in original post

6 REPLIES 6

Hello @Sophtee, Instead of 2 tables you could add another column to that setup called "Type", and that can be either "Start" or "End", so then the start mileage would be equal to this:

INDEX(SORT(SELECT(Vehicle mileage[mileage],[vehicleREF]=[_THISROW].[vehicleREF]),TRUE),1)

You can use that value to display it in any way you want, as I am not really sure what you mean by "error message", maybe you mean that the end milage should be the same as the next start mileage? In that case it would be used in a valid_if()

Okay, I would use one table and use the suggested equation.

I am sorry if I was not clear.. but yes, I would like this to be a valid_if statement.

It is more so to allow the user to be honest when entering the mileage at the start of a new destination.

So the new start mileage to be entered by the user must be equal to the end mileage they entered before..... and I would like to put this in the valid_if section 

It worked!! thank you so much 

But the value is automatically showing in the start mileage entry, is it possible to not show the value?

Sophtee_0-1653352481615.png

 

 

Hi @Sophtee !

At first I would like to insist that you should not use two tables as first three columns are repeated. It is redundancy and should not be practiced any way. Instead you can use one table as @Rafael_ANEIC-PY suggested. So your columns should be driver name, vehicle number, location, and mileageStart, mileageEnd. If you have many mileage for one vehicle, then your table structure can be, Table 1(VehicleInfoID as key column, driver name, vehicle number, location) and Table 2 (VehicleInfoID, mileage). The structure and suggestion would be more precise if the last section would be stated more clearly. It is not understood exactly, what is the question/issue.

Thanks.

Okay, I am sorry if I was not clear. 

There will be multiple times the user would be entering mileage data for one vehicle. This would be for the start of the destination and at the end of a destination. 

And, as a valid statement, I want the end mileage to be equal to the start mileage of a new destination. And, for this to be a valid_if statement

@Sophtee it shows there probably because you've placed it as an initial value, and not as a valid_if condition

Top Labels in this Space