How can I filter out the most recent n entries?

Hello,

My apologies if this has been asked before, but Iโ€™ve been working on this for a week and have not found a solution. Also, first time posting and if there is anything I missed out, please let me know. Thanks in advance!

I have a table with entries of my work sessions and I would like to have a view where I only see the most recent n-amount of entries. My current workaround is to have a form sorted by descending [time stamp].

I would also like to create a graph based on the most recent n-amount of entries. So then I figured I would need โ€œa new set of dataโ€.

My attempts thus far have involved using Slice and VCs. Both of which have no success.
Iโ€™ve tried creating a Slice with the expression: [module (wk)]=โ€œMDP Anatomyโ€ AND sort([time stamp],TRUE)
Iโ€™ve also created a VCs where I used Sort() to have a descending list based on a given category.

Any help or suggestions would be most appreciated!

Best regards,
Daniel

Data:

Solved Solved
0 9 243
1 ACCEPTED SOLUTION

I checked, but it is set to table type view.

I then noticed that the unwanted chart โ€œlayerโ€ was another ref view I have using Log (Confidence).

I experimented and deleted โ€œConfidenceโ€, then the unwanted layer became โ€œDurationโ€. The pattern followed with the deletion of โ€œDurationโ€. After I got rid of all the chart ref views, I was able to have the way I wanted.

So then I created a slice of Log, and then created the ref chart views based on this new slice. Not sure if this is the best way to do this, but it is a solution.

@Suvrutt_Gurjar Thank you so much for your kind assistance!

View solution in original post

9 REPLIES 9

Welcome to the AppSheet community.

Please evaluate using ORDERBY() and TOP() functions. Also please take a look at the sample app referred to below. You could use a combination of ORDERBY() and TOP() in a slice filter as well.

https://www.appsheet.com/samples/How-to-find-the-top-four-items-in-a-list?appGuidString=bb25c579-700...

Thank you so much for pointing me in the right direction!
I looked at the suggested sample app, which provides a solution to what I want to do. Thank you again for that.

But unlike the sample app, which provides a table when clicking into one of the items, in my app there is an additional โ€œlayerโ€. Iโ€™ve replicated the expressions from the sample app, and so Iโ€™m not sure why this is an issue.

Any suggestions is most appreciated. Thank you in advance!

3X_7_a_7a2df60b73c4eeac179403755e3f3065a9414f20.gif

Hi @Danny_W ,

Could you please elaborate? It is not exactly clear how you have implemented and what you are trying to achieve. On which table you wish to have the recent records? Relevant screenshots if possible will help.

Thanks @Suvrutt_Gurjar for the reply!

So my main set of data is in Log. Here is a screenshot.

The main categorisation is based on [module (wk)], and its related table is under โ€œModule filterโ€.

Iโ€™m trying to make it so that I can choose the item from [module] and I only see the most 2 recent entries within Log.

Imitating the sample app, I created a VC in โ€œModule filterโ€ combing TOP() and ORDERBY().

I then created a table view for โ€œModule filterโ€ and the result was the gif from the previous post with the extra โ€œlayerโ€.

Thank you again for your time!

Thank you for all the details @Danny_W . Could you elaborate what you mean by โ€œextra layerโ€? Is it two related graph views and you do not wish to see one or both graph views?

Or do you wish to see the table view only skipping teh graph views display?

Apologies. Yes, I meant the graph views as the โ€œextra layerโ€. I only wish to see the table and skip the graph view. I donโ€™t understand why there is a graph view.

Thank you.

Thank you. Do you see a reference view called something as Logs_Inline

If that view is chart type, could you change it to table type view?

I checked, but it is set to table type view.

I then noticed that the unwanted chart โ€œlayerโ€ was another ref view I have using Log (Confidence).

I experimented and deleted โ€œConfidenceโ€, then the unwanted layer became โ€œDurationโ€. The pattern followed with the deletion of โ€œDurationโ€. After I got rid of all the chart ref views, I was able to have the way I wanted.

So then I created a slice of Log, and then created the ref chart views based on this new slice. Not sure if this is the best way to do this, but it is a solution.

@Suvrutt_Gurjar Thank you so much for your kind assistance!

Nice to know you got a solution @Danny_W

Thank you for the update. All the best with your app-building.

Top Labels in this Space