Command PV REPORT ONE

4D View

PV REPORT ONE

version 6.8


PV REPORT ONE (area; column; row; master; tableBreak; fieldBreak; operator; tables; fields; insert; detail; title)

ParameterTypeDescription
areaLongint4D View area
columnLongintColumn number
rowLongintRow number
masterIntegerPrimary table number
tableBreakIntegerTable number where break occurs
fieldBreakIntegerField number where break occurs
operatorIntegerOperations to execute
tablesIntegerTable number of field to display
fieldsIntegerNumber of field to display
insertInteger0 = Replace; 1 = Insert rows
detailLongintDetail insertion options
titleStringBreak title

Description

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.

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)

See Also

PV ARRAY TO CELLS, PV REPORT MANY.

Constants

PV Report functions theme.