How to perform "Last" functions in Baserow

Are you using our SaaS platform (Baserow.io) or self-hosting Baserow?

SaaS

What do you need help with?

Hi there,
We have a business where we rent trailers out to customers from point A to point B. We have a couple of branches and own a fleet of trailers. I have setup a table where we capture all contracts called Main Contracts File. I have a different table with all the trailers in the fleet. In the contracts table a trailer will therefore be rented out more than once. Now I want to setup a field in the contracts table to show the last drop off location as the “Current Location”. This is to help us see exactly what stock is at each branch. In the Trailers Stock table I have a lookup that lists all the branches where a specific trailer has been to over time. The field returns a list of all the branches but in alphabetical order, and not necessarily the branch that is last on the Contracts database. I can’t find a function to extract the last entry, and then also need to overcome the alphabetical sorting problem for lookups . Are there any suggestions to overcome this?

Hey @Deon, welcome to the Baserow community :wave:

Is the last entry always the latest date? If yes, you can use the max function :slightly_smiling_face:

Hey @olgatrykush, if I create a lookup field in a table, and it returns more than one entry as the answer and it is a text value, then the lookup field automatically sorts the responses alphabetically, which throws out their order. If am able to perform the max calculations on dates, but when using lookup to pull over text values, it does not work. It will return the last entry, but because they are autmatically sorted alphabetically, they are not in order from first to last based on the table the info is pulled from.

Hey @Deon, you’re right that solution won’t work for the text fields. Let me check with the team if there are any other workarounds.

We have the issue in the pipeline for custom order but it won’t really fix your issue: Different ordering of link row values (#1785) · Issues · Baserow / baserow · GitLab :thinking: