crystal-reportsdrilldown

Need to do 2 group in Crystal report


Hello i need to do a report in crystal report with 2 group, first groug: hourbyproject and the second: expence. i need them separeted and i need too have a detail for each one when i double clic for the drilldown

exemple :

Group 1 Project :

 -project 1
 -project 2
 -project 3

Group 2 expence

 -expence 1
 -expence 2

note each project are in a datatable and each expence are in a other datatable and i need that when i drill down i show only the chosen item

ty for you help :)


Solution

  • Ideally you should create a view that truncates both tables (assuming you are using an SQL based data source), it will need to be something like:

    CREATE VIEW MYVIEWNAME
    
    AS 
    
    SELECT 'Project' AS [TypeName],
           Somefield,
           SomeOtherField
    
    FROM MyProjectTable
    
    UNION ALL
    
    SELECT 'Expense' AS [TypeName],
           Somefield,
           SomeOtherField
    
    FROM MyExpenseTable
    

    Then once you add this as a source in Crystal you can group by TypeName first then group by the project/Expense.

    If you want different details displayed, create a new details section and add the suppression formula {Mytable.TypeName}="Project" to the Expense section and vise versa for the Project section.