4D v13

PV REPORT ONE

Home

 
4D View v13
PV REPORT ONE

PV REPORT ONE 


 

PV REPORT ONE ( 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  Integer in Field number where break occurs
operator  Integer in Operations to execute
tables  Integer in Table number of field to display
fields  Integer in Number of field to display
insert  Integer in 0 = Replace; 1 = Insert rows
detail  Longint in Detail insertion options
title  String in Break title

The PV REPORT ONE 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 this field 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 ONE command. It may have additional order by criteria that will not be considered in the break. For additional 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 #:" and get "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 a client list in a 4D View area, seperating men and women and indicating the number of records for each group:

 C_LONGINT($Column`Column number
 C_LONGINT($Row`Row number
 C_INTEGER($Master`Primary table number
 C_INTEGER($TableBreak`Number of table where break occurs
 C_INTEGER($FieldBreak`Number of field where break occurs
 C_INTEGER($Operator`Operation to execute
 C_INTEGER($Table`Table number of fields to display
 C_INTEGER($Field`Number of fields to display
 C_INTEGER($Insert`0=Replace;1=Insert rows
 C_INTEGER($Detail`Detail display options
 C_STRING(20;$Title`Title of the result row
 
  `Initialize
 $Column:=4 `Display starting from column C
 $Row:=3 `Display starting on the 3rd line (Title + empty row)
 $Master:=Table(->[Clients]) `Clients table is swept
 $TableBreak:=Table(->[Clients])
 $FieldBreak:=Field(->[Clients]Type) `Break on the client type
 $Operator:=pv report function count `Calculate the number of men and women
 $Table:=Table(->[Clients]) ` Clients table fields
 $Field:=Field(->[Clients]Name) `To print names
 $Insert:=1 `Insert requested
 $Detail:=2 `Detail rows are inserted, values are displayed once
 $Title:="Total"
 
 ALL RECORDS([Clients])
 ORDER BY([Clients];[Clients]Type;[Clients]Name) `Order by necessary at break + display alphabetically
 
 PV REPORT ONE(Area;$Column;$Row;$Master;$TableBreak;$FieldBreak;$Operator;$Table;$Field;$Insert;$Detail;$Title)

 
PROPERTIES 

Product: 4D
Theme: PV Cell value
Number: 15903

 
INDEX

Alphabetical list of commands

 
HISTORY 

Created: 4D View 6.8

 
SEE ALSO 

PV ARRAY TO CELLS
PV REPORT MANY