You can translate the question and the replies:

How to include record count in report output; all in one view

Hello, Is there a way I can add a column in a report output that contains the record count in a single view? I am able to accomplish this now by generating the output in one view first and then creating a second view where I do a count off of the first table, followed by a third view where I bring in the total count into the output from view one; however because of a deadlock issues I am expieriencing I am looking to accomplish these steps all in one views. An example is below. I have a view that generates 3 records. What I do now is run the view that generates the output of ID, PHONE and TYPE, and then in a second view I do a count(*) to get the total count and then to bring in the total count back into the view that contains the output I have to create a third view. I need to take these three steps and complete them in one view. This will help me avoid the deadlock issue. Can you please advise if there is a way I can get the record count and have it in my report output all in one view? Thanks Report Output Example: **ID Phone Type Record Count** 501A 555-5555 Member 3 302A 555-5555 Subscriber 3 405A 555-5555 Member 3
user
06-08-2019 10:10:37 -0400
code

1 Answer

Hi, To get the expected results as yours, I would follow the below steps, 1. In Source Configuration tab of JDBC data source, verify if the analytical function [COUNT](https://community.denodo.com/docs/html/browse/6.0/vdp/vql/appendix/syntax_of_condition_functions/analytic_functions_window_functions#count) is added to the ‘Delegate analytic functions list’ property. Select the checkbox and add the COUNT analytical function separated by commas. 2. Create a Selection view over the base view. 3. In the output tab add a new field with the field expression: count(*)over([<clause>][<byclause>]). Note that the VirtualDataPort will not execute this analytical function, the query will be pushed down to the underlying data source. If the underlying data source doesn’t support this analytical function, then you could enable a full cache mode on the base view with Cache database that supports the *count* analytical function. For more information on this, you could refer to section [Configuring the Cache of a View](https://community.denodo.com/docs/html/browse/7.0/vdp/administration/creating_derived_views/advanced_configuration_of_views/configuring_the_cache_of_a_view#configuring-the-cache-of-a-view) of Virtual DataPort Administration Guide. In order to handle deadlocks in VirtualData Port, you could have a look at the KB article [Debugging deadlocks in Virtual DataPort](https://community.denodo.com/kb/view/document/Debugging%20deadlocks%20in%20Virtual%20DataPort?category=Common+Errors). Hope this helps!
Denodo Team
07-08-2019 04:43:33 -0400
code
You must sign in to add an answer. If you do not have an account, you can register here