mastereh Posted June 15, 2012 Share Posted June 15, 2012 I'm trying to create a table which contains summarized data based on various functions. How do I have multiple steps calculated in iReport? Do I have to create multiple tables and then use the designer to have them sit next to each other? or should I create multple sub-reports (1 for each column)?First column:SELECT count(Policy."PolicyNum") AS Total_PoliciesFROM "dbo"."Policy" Policy INNER JOIN "dbo"."PolicyTerms" PolicyTerms ON Policy."PolicySK" = PolicyTerms."PolicySK"WHERE PolicyTerms."TermStatus" = 'Active' and PolicyTerms."TermExpiry" >= $P{UV_Date} Second Column :SELECT count(Policy."PolicyNum") AS Total_AutoFROM "dbo"."Policy" Policy INNER JOIN "dbo"."PolicyTerms" PolicyTerms ON Policy."PolicySK" = PolicyTerms."PolicySK"WHERE PolicyTerms."TermStatus" = 'Active' and Policy."LineOfBusiness" in ('AP','AC') and PolicyTerms."TermExpiry" >= $P{UV_Date} Third Column:SELECT count(Policy."PolicyNum") AS Total_Person_AutoFROM "dbo"."Policy" Policy INNER JOIN "dbo"."PolicyTerms" PolicyTerms ON Policy."PolicySK" = PolicyTerms."PolicySK"WHERE PolicyTerms."TermStatus" = 'Active' and Policy."LineOfBusiness" in ('AP') and PolicyTerms."TermExpiry" >= $P{UV_Date} Any suggestions on how to best do this would be great. Thanks. Link to comment Share on other sites More sharing options...
ernestoo Posted June 15, 2012 Share Posted June 15, 2012 Subreports are one way..but if you put different things in the WHERE clause I don't see how you would make them line up.. You could use subqueries http://beginner-sql-tutorial.com/sql-subquery.htm or you could use stored procedures in the database Link to comment Share on other sites More sharing options...
mastereh Posted June 15, 2012 Author Share Posted June 15, 2012 Thanks for those. In the end I want my table to look something like this: Total Policies | Total Auto | Total Property | Total Commercial 5000 | 2500 | 2000 | 500 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now