4D View v14

PV REPORT MANY

Home

 
4D View v14
PV REPORT MANY

PV REPORT MANY 


 

PV REPORT MANY ( area ; column ; row ; master ; tableBreak ; fieldBreak ; operator ; tables ; fields ; insert ; detail ; title ) 
Parameter Type   Description
area  Longint in 4D View area
column  Longint in Column number
row  Longint in Row number
master  Integer in Primary table number
tableBreak  Integer in Table number where break occurs
fieldBreak  Array in Field number where break occurs
operator  Integer array in Operations to execute
tables  Integer array in Table number of fields to display
fields  Integer array in Number of fields to display
insert  Integer in 0 = Replace; 1 = Insert rows
detail  Integer in Detail insertion options
title  String in Break title

The PV REPORT MANY command creates a report in the 4D View area using the values from 4D fields specified in tables and fields starting from the current selection of the master table. An operation can be applied to each of these fields defined by operator: subtotal, number, maximum, etc. To define the operator parameter, use the constants in the PV Report functions theme:

Constant Type Value
pv report function average Longint 1
pv report function count Longint 4
pv report function max Longint 3
pv report function min Longint 2
pv report function none Longint -1
pv report function sum Longint 0

The generated result is inserted in the area from the cell set by column and row.

tableBreak and fieldBreak assign the field where the break sequence will be executed. The breaks allow separating records in homogenous groups and executing intermediary calculations for each group.
A break is a value change in an order by table. It is necessary to associate this break level to an order by criteria. The order by for a selection of tableBreak and fieldBreak records is necessary before using the PV REPORT MANY command. It may have additional order by criteria that will not be considered in the break. For more information on building quick reports with breaks, refer to the 4D Design Reference manual.

The insert parameter determines if the data placed in the 4D View area using this command must either replace cells that may be present or must be inserted into new rows. If you pass 0, the data is cleared and replaced. If you pass 1, additional rows are inserted.

The detail parameter allows you to define the way 4D View will insert the detail as well as the break rows in the report:

  • If you pass 0 in detail, only break rows are inserted (the detail rows are not inserted).
  • If you pass 1 in detail, the detail rows are inserted and the break value is repeated on each row.
  • If you pass 2 in detail, the detail rows are inserted but the break value is only displayed once.

The title parameter allows you to set the title of the result row (i.e., "Total", "Average", etc.). As in the 4D Quick Report editor, you can use the # character as a placeholder for the current break value. For example, if the “Country” field is your break field, you can pass "Total for #:" in title. The report will display "Total for USA:" then "Total for Japan:", etc.
Pass an empty string if you do not want to insert a title.

Note: If detail is set to 0 and the title is an empty string, the first column is not inserted (it would then be empty).

Example  

Display, in an included 4D View area in the client entry form, a report of contacts linked to this client, with a break indicating the number of contacts for each title: secretary, developer, documentation department, etc. An automatic relation exists between the contacts table and the titles table.

 C_LONGINT($Column`Column number
 C_LONGINT($Row`Row number
 C_INTEGER($Master`Master table number
 C_INTEGER($TableBreak`Table number where break occurs
 C_INTEGER($FieldBreak`Field number wher break occurs
 ARRAY INTEGER($Operator;3) `Operations to execute
 ARRAY INTEGER($Tables;3) `Table number of fields to display
 ARRAY INTEGER($Fields;3) `Number of fields to display
 C_INTEGER($Insert`0=Replace;1=Insert rows
 C_INTEGER($Detail`Detail display options
 C_STRING(30;$Title`Title of the result row
 
  `Initialize
 $Column:=4 `Display starting at column D
 $Row:=3 `Display starting in the 3rd row (Title + empty row)
 $Master:=Table(->[Contacts]) `This is a "report" of the contacts table
 $TableBreak:=Table(->[Titles])
 $FieldBreak:=Field(->[Titles]Label`Break will occur on contact title
 
  `Display in column 1 the number for each type
 $Operator{1}:=pv report function count
 $Tables{1}:=Table(->[Titles])
 $Fields{1}:=Field(->[Titles]Label`Label of column 1 title
 
 $Operator{2}:=pv report function none `No calculation in column 2
 $Tables{2}:=Table(->[Contacts])
 $Fields{2}:=Field(->[Contacts]ContactName) `Name of contact column 2
 
 $Operator{3}:=pv report function none `No calculation in column 3
 $Tables{3}:=Table(->[Contacts])
 $Fields{3}:=Field(->[Contacts]ContactFirstname) `First name of contact column 3
 
 $Insert:=1 `Insert
 $Detail:=2 `Detail rows are inserted, values are displayed once
 $Title:="Number of contacts for #" `The # will be replaced by the current break value
 
 RELATE MANY([Clients]Code) `Get client contracts
  `Sort necessary at break + display in alphabetical order
 ORDER BY([Contacts];[Titles]Label;[Contacts]ContactName;[Contacts]ContactFirstname)
 
 PV REPORT MANY(Area;$Column;$Row;$Master;$TableBreak;$FieldBreak;$Operator;$Tables;
 $Fields;$Insert;$Detail;$Title)

The selection will depend on links between tables at the database structure level, field numbers and arrays passed as a parameter to the command.

 
PROPERTIES 

Product: 4D View
Theme: PV Cell value
Number: 15904

 
HISTORY 

Created: 4D View 6.8

 
SEE ALSO 

PV ARRAY TO CELLS
PV REPORT ONE

 
ARTICLE USAGE

4D View Language ( 4D View v11.4)
4D View Language ( 4D View v12)
4D View Language ( 4D v13)
4D View Language ( 4D View v14 R2)
4D View Language ( 4D View v14)
4D View Language ( 4D View v14 R3)
4D View Language ( 4D View v14 R4)