It has been a quiet Tuesday morning at Badabing Ltd. Had some decent coffee, checked all reports went out last night, and basked in the glory of a sea of green "OK" calculation statuses. As you ponder whether to dig into your third cannoli of the day, a voice booms across the office: "Hey Joey! Joey! Camhear.... Y'know the top-5-products report you sent out last night, yea? The one they built for us back in 2021, them wunderkids from the City? Boss wants to make it top-10, and to bring extra columns in it. Oh, and make it a bit different - all our reports kinda look the same, he gets confused, y'know, and we don't want him confused - he might whack the wrong thing, 'nowwattamean?"
"... Sure, am on it."
This is gonna be painful. That report uses some custom Dashboard DataSet and Member List, written by someone trying to earn their fee by looking clever. You kinda know your VB from your C#, but changing this pile of hacks looks daunting. Y'know what, fuggedaboutit - you're just going to scrap it and rebuild the report without any code!
The data - Cube View + Data Adapter
First, we'll have to find the data we need. Cube Views are great for that! So you quickly build a simple CV with all your product sales data.
![JackLacava_0-1714041444319.png JackLacava_0-1714041444319.png](/t5/image/serverpage/image-id/9834i7AF3945902C394F4/image-size/medium?v=v2&px=400)
CVs don't allow for sorting by value, and without code they can only be formatted in a standard way for PDF output. That's alright; we have Dashboard Components that are much more customizable! To bring our CV data to such components, we will simply build a basic Data Adapter (on the Workspaces page for v.7.3+, or Dashboards page for older versions).
![JackLacava_1-1714041596115.png JackLacava_1-1714041596115.png](/t5/image/serverpage/image-id/9835i92D56BE8CCBA7A4E/image-size/medium?v=v2&px=400)
Interactive Report - BiViewer
Alright, so we got the data, how do we display it? BiViewer is the obvious choice for interactive reporting. It looks nice and it's so easy to configure. First we attach the DataAdapter and save:
![JackLacava_1-1714045380642.png JackLacava_1-1714045380642.png](/t5/image/serverpage/image-id/9843i70DD3090630173B5/image-size/small?v=v2&px=200)
Then we switch to BI Designer, create a Grid, drag and drop a few columns and boom, it's done.
![JackLacava_3-1714042113210.png JackLacava_3-1714042113210.png](/t5/image/serverpage/image-id/9837iDE5DBEF7B8A3F5CC/image-size/medium?v=v2&px=400)
Ok, but now we have too many products, and not sorted. How do we fix that? Easy:
![JackLacava_4-1714042165445.png JackLacava_4-1714042165445.png](/t5/image/serverpage/image-id/9838i70F2C7EBCBCECDD9/image-size/medium?v=v2&px=400)
![JackLacava_6-1714042233910.png JackLacava_6-1714042233910.png](/t5/image/serverpage/image-id/9840i54E37B2448E2A205/image-size/medium?v=v2&px=400)
![JackLacava_7-1714042257725.png JackLacava_7-1714042257725.png](/t5/image/serverpage/image-id/9841i8A3B487C7043BEBF/image-size/small?v=v2&px=200)
And it's done! We can now trivally add some bells and whistles: extra columns, custom formatting, and so on.
Print-perfect Reporting - Report Component
Bi Viewer is great, but the Boss is old-fashioned: he likes paper that can be stored away, just in case something happens, y'know? How do we deal with this? Easy: with the Report Component.
We create the component and again attach the very same adapter:
![JackLacava_1-1714045380642.png JackLacava_1-1714045380642.png](/t5/image/serverpage/image-id/9843i70DD3090630173B5/image-size/small?v=v2&px=200)
We then switch to the Report Designer, and we drag and drop our fields in the Detail Band:
![JackLacava_2-1714045616780.png JackLacava_2-1714045616780.png](/t5/image/serverpage/image-id/9844iFD7900294AF438D9/image-size/medium?v=v2&px=400)
Next, we need to sort our records, using the Group And Sort toolview:
![JackLacava_3-1714045688609.png JackLacava_3-1714045688609.png](/t5/image/serverpage/image-id/9845i511A5B62C439145A/image-size/medium?v=v2&px=400)
We select our Amount field from the Add a Sort menu
![JackLacava_4-1714045738967.png JackLacava_4-1714045738967.png](/t5/image/serverpage/image-id/9846i6B32F7C197E23803/image-size/medium?v=v2&px=400)
Then set it to sort in Descending order
![JackLacava_5-1714045811365.png JackLacava_5-1714045811365.png](/t5/image/serverpage/image-id/9847i9F74AEB4E0BAECA4/image-size/medium?v=v2&px=400)
At this point, data in the report would be sorted correctly, but it would still show too many products rather than the top 10. To cut the number of records displayed, we have to open the properties of our Report object, and select the gears icon:
![JackLacava_6-1714045942464.png JackLacava_6-1714045942464.png](/t5/image/serverpage/image-id/9848i5F6F8BFA7C8769FA/image-size/medium?v=v2&px=400)
We then expand "Report Print Options" to find the Detail Count value. By default it's set to zero, which means all records will be displayed. By changing that we can limit our output to the first 10 records:
![JackLacava_9-1714046771752.png JackLacava_9-1714046771752.png](/t5/image/serverpage/image-id/9851iE43A1C8EA002FC2F/image-size/medium?v=v2&px=400)
(If you're wondering what the difference is between that and the "at Design Time" version: "Design Time" is when you look at the Preview tab in the Report Designer. If you know you have a lot of records and you're just testing some layout tweaks, you can set this to a low number to speed up preview generation. Like for the other version, a zero means it's disabled and all records will be displayed.)
And this is our output:
![JackLacava_10-1714047015227.png JackLacava_10-1714047015227.png](/t5/image/serverpage/image-id/9852i28582EB6E18E2227/image-size/medium?v=v2&px=400)
Now we'll have a bit of fun with graphics, formatting, and so on, making our report stand out. Hey - all this was so fast, there are still some cannoli left!