Filter data components

Can someone help me? I want to display the last registration number(Licence plate no.) entered by the driver, but not based on date because Saturday and Sunday the drivers don’t work and I can’t put the condition “Date is within yesterday” in filter data.
Only one registration number appears in the print screen because only one is entered.

You have a bit of a challenge there, because you are using a Big Table.
Before I attempt to offer any solutions, let me ask you something.
If you only want the last plate number, why are you offering that in a choice component?
Seems a bit pointless to have a choice component with only one option?

I’m still learning, this was a solution for me at that moment. If you have another idea, I want to hear it

Okay, so firstly I would ask why you chose to use a Big Table for this?
Generally the only time you would choose a Big Table is if you are expecting tens of thousands of rows to be added. Is that the case?



Sorry, but I have another question.

Will the selected driver always be the user that is submitting the form, or could a user submit and choose any driver?

The selected driver will only be the user that is submitting the form.

Great, I was hoping you would say that. That makes it a bit easier.

So here is my suggestion. I’m not 100% certain this will work, but I think it should.

  • You will need to add a column in your table to store the users email address (it’s good practice to do this anyway)
  • Once you have that, in your table, create a Query column, target it at the same table and apply the following filter:
    – Driver email is signed in user
    – Also sort the query by Date in descending order
  • Next add a Joined List column that targets the Plate number via the Query column. This should give you a list of all the logged plate numbers for that user, with the first one being the most recent one.
  • Next you need a JavaScript column using the following code:
return p1.split(', ').shift();
  • In the JavaScript column, replace p1 with your Joined List. The JavaScript column should return just a single plate number, which is the one that you want.
  • Now, back in your form, get rid of the choice component and replace it with a column value. The column value should take the value in the JavaScript column and write to the Plate number column.
  • The other thing I would suggest is to remove the choice for driver selection, and instead pass the signed in users email as a special value with the form.

I will try, thank you very much. :clap:

It worked!! :partying_face:

1 Like

woah, that’s great!

I’m always a bit nervous when I offer up semi-complex solutions like this without having an opportunity to test. Glad it jot the job done for you :+1:


“semi-complex”…don’t sell yourself short - I would call that complex.

JavaScript.returnFirstItem(Joined List of Plates(Query(sorted by date)) = Latest Plate # is a great technique.

1 Like

hehe, necessity is the mother of invention :wink:
I’ve done a lot of work with Big Tables, and that combo of Joined List & JavaScript has saved me many times…
A Split Text/Single Value combo would do the same as the JavaScript column, but a single line of code is nice and efficient.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.