Through the Customization screen, how can I limit a dataview to the first 20 rows?

Hello,

For what I am doing, I need to have a dataview only show the first X rows (20 for example).
I am unsure on how to do. Any ideas?

Thanks,
Shawn

Give us a bit more. For what are you doing? Are you trying to limit what the users see? Trying to improve performance? What’s the goal?

@jgiese.wci ,

I have a BAQ that sends all the data I need between a start date and end date parameter.
I put it in a dashboard and attached to menu.
I am doing a customization on it that will filter out per selected site.

What they want is the top X rows for either Total Qty or Total Price.
I set up my dynamic filter to return a specific site they type in.

My next step is to try and limit the dataview to the top x rows.

The reason I am trying to do it here is so I can change the sort and have different rows show in the top X rows without having to refresh the screen and trigger the BAQ again.

I hope I am making sense.

You can set a TOP clause in the BAQ itself. When viewing different aspects of a topic in a single dashboard, I tend to set different panels in the dash. I get that you want something a little more minimalist and perhaps elegant, but is it really worth the tech debt of a customization?

You might use what @Banderson did here in two different subqueries (one for quantity and one for price) and capture the row_number and filter as needed.

If I set the TOP in the BAQ, I don’t get all the results I need.

EX: I set the top to 20, It returns 20 rows across my three Plants.

I filter out to one plant and now I only have 6 rows instead of the 20.

Also, it will only return the top 20 results in whatever order I sorted in the BAQ.

If I needed to sort in a different way, then the results would be incorrect.

EX: I sort by Qty DESC, it returns my top 20 by Qty. My employee needs to get the top 20 by Price DESC. If he just clicks the column to sort what already shows, it would not be the correct data. The top 20 by Price may be a different result set.

I was thinking I could get around that by returning the entire result set and filtering and sorting in the dashboard.

Is there a flaw in my thinking?

I do have a habit of overthinking stuff, lol.

@Mark_Wonsil ,

I feel like I need to do in the customization if possible.

If there is a reason not to, then I can try and explore other options.

Anybody have any customization ideas?

A customization won’t upgrade to Kinetic if you do code-behind work. If you’re just using filters, then that should upgrade.

What I’m suggesting is adding a column that calculates the rank by Price and another column by Quantity. Now you can filter/sort as needed.

If you truly only want to “return” 20 records, then, unless you know the top 20 records for both price and quantity will always be the same records just sorted differently, you’re going to have to have two queries.