Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8620

Re: How to insert Page Break when Summary value in Group Footer changes?

$
0
0

hi Max,

 

there's a couple of ways you can do this.

 

a) use a sql expression to get the max employee id

 

have a look at the attached report. extract the contents and change the .txt extension to .rpt. have a look at the employee sql expression on the report.

 

(select max(`O`.`Employee ID`) from `Orders` `O` where `Customer`.`Customer ID` = `O`.`Customer ID`)

 

this is running a sub query to grab the maximum employee id for every customer id. note that in the sql expression, an alias is being used 'O' so that the where clause can reference the field from the main report. in the sample report, the first group is on the employee id and the second group is the other id. therefore creating a new page after group footer 1 is simple.

 

note that using a select in a sql expression is not supported but this may work for you. usually oracle is problematic for this method.

 

b) write a new report  using a command instead of tables

 

if you copy the show sql from your report, database menu, then you have a base query to use as command object. then create a new report and in the database expert press "Add Command" and paste this syntax in.

 

now you need to add a subquery to grab the employee id...here's an example using sql that works in access...your sql may vary depending on your database.

 

SELECT

`Customer`.`Customer ID`,

(select max(`O`.`Employee ID`) from `Orders` `O` where `Customer`.`Customer ID` = `O`.`Customer ID`) AS EmployeeID

FROM 

`Customer` `Customer` INNER JOIN `Orders` `Orders`

ON `Customer`.`Customer ID`=`Orders`.`Customer ID`

 

once you have that employee id value as a normal field, then it's easy to create a first group on that id and then a second group on your second id field. then a new page after group footer 1 is simple.

 

i hope this helps,

jamie


Viewing all articles
Browse latest Browse all 8620

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>