Hi all~
Recently, had to do this--and was confused because some of the documentation on "Expressions" was outdated.
So i'll sort of lead you through a step by step of how to get the most RECENT record in a List View!
Step 1: Getting the most recent date
To be able to use expressions, we need to have a data label. (** for better asthetics, you can always choose to hide this by unchecking 'Visible'**)
Next, we configure the expression, to give us the most recent date!
Looking at the official documentation, I thought that there was a "Maximum" function under Date/Time :
However, this is not there anymore. Instead, we can use the "List Maximum" function under List Aggregators.
Input the date column from your smartobject... and voila! You're good to go!!
To test this, feel free to run the view, and verify that the date returned in the datafield is the most recent date.
Step 2: Passing the expression into the Smartobject
Now, you can do this any way you like. The way i thought was educational and interesting, is directly passing the expression into the smartobject, to filter out the result i wanted.
Using the "Get List Items" method of my List View's smartobject........
I passed in the "Max Date" expression (the expression created on step #1).
To get me the most recent "Title".
YAY! Done!
Now, we just add a few columns, with the titles and the dates.... and we can see that the most recent title is pulled back :)
NOTE: data labels and button clicks are used for simplicity to easily show beginners how this functionality works. They are not the best / recommended way to do this. One can always use a stored proc or other advanced techniques to achieve the same thing.