Most recent date on the right AND query most recent first

  • 1
  • Question
  • Updated 3 years ago
  • (Edited)
I am charting blood pressure and weight on a chart.  I have hundreds of data points and I just want to capture 20 to 30 of the most recent points and then allow the end user to load more in via the table below the chart if they want more. 

Here is my dilemna. I want the most recent date on the Right side of the chart and the oldest date on the left.  In order to do this I have been sorting Date_Time__c Asc.  This switches the chart, to show the newest date on the right which is great.  Unfortunately this also queries the oldest date first I.E. it is grabbing the first 20 to 30 records from 2007.  Is there a way to get the newest date on the right but make the model grab the most recent 20 to 30 records instead of the first?

Thank you!
Photo of Rich Slack

Rich Slack

  • 4,134 Points 4k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Rich Slack

Rich Slack

  • 4,134 Points 4k badge 2x thumb
In the interim I set a condition to be the last 365 days.  But it would be cool if they could load in the whole history if they wanted it.
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
I don't know if this would work, but you could try to set up a second model (Model2). Set that model to max 30 records in DESC order. Then set a condition on your original model (Model 1) to only include records that are in the second model. That should limit your records to just the 30 most recent, but display them in ASC order since that is how Model 1 is ordered. Then to change your date ranges, you would effect conditions on Model2 which should reflect in Model 1.