User Tools

Site Tools


field_and_record_commands

Field and Record Commands

PrintList Pro uses the SELECTION RANGE TO ARRAY command in 4D to get the records for printing.

Up to 32767 fields (columns) can be printed in a PrintList Pro object.

Using the Field Printing Capability

Temporary Arrays

PrintList Pro internally uses interprocess 4D arrays to get the record data from 4D. These arrays do not have to be declared in 4D.

Arrays and Fields

Arrays and fields may not be printed together in the same PrintList Pro object. If arrays are printed in an object, then the field commands will be ignored. Conversely, if fields are printed in an object, then the array commands will be ignored.

Printing 4D Fields

Fields from a main table and from related one tables may be printed in the same PrintList Pro object. See the commands PL_SetFile and PL_SetFields for further information about printing fields from related one tables.

Sorting

PrintList Pro uses 4D’s sorting routines when sorting fields.

When printing records, fields from a related one table can be included in a sort.

Time Data

Time data will be converted to a longint since this is how it is stored internally by 4D.

Maximum Number of Records Printed

The maximum number of PrintList Pro records printed in a PrintList Pro object is only limited by 4D’s own limitations and available memory.

Performance Issues When Printing Fields

When PrintList Pro prints fields, the automatic column sizing algorithm uses only the first 20 records (or less, if the selection contains less than 20 records) in the selection. These records are always read regardless of whether the columns are automatically or manually sized.

Therefore there is no performance penalty using the automatic column sizing algorithm when printing fields.

See Performance Issues with Formatting Commands for more information.

Commands

PL_SetFile

(areaRef:L; tableNum:L) ª resultCode:L

Parameter Type Description
→areaReflongintReference of PrintList Pro object on layout.
→tableNumlongintNumber of 4D table.
←resultCodelongintResult code.

PL_SetFile tells PrintList Pro what table is the main table from which to print records.

This command is only necessary if the field to be printed in column one is not from the main table, but from a related one table.

PL_SetFile must be called before any fields have been set, otherwise it will be ignored. If this command is not called, then PrintList Pro will use the table of the field printed in column one as the main table.

resultCode — The possible values are:

Constant Value Action
PL SetFile Passed 0 Reference of PrintList Pro object on layout
PL Not enough memory5Increase 4D’s RAM partition
PL Not a file6Check to make sure that the table represented by tableNum does exist
PL Wrong 4D version10(obsolete)
PL Arrays have been set11You’ve attempted to set fields or a table when arrays have already been set
PL Fields have been set12You’ve attempted to set arrays when fields have already been set

Example

 $result:=PL_SetFile (eList;Table (->[People]))

PL_SetFields

(areaRef:L; tableNum:L; columnNumber:L; numFields:L; field1; …; fieldN:L) ª resultCode:L

Parameter Type Description
→areaReflongintReference of PrintList Pro object on layout.
→tableNumlongintNumber of 4D table.
→columnNumberlongintColumn at which to set the first field.
→numFieldslongintNumber of fields to set (up to 15).
→field1; …; fieldNlongintNumber(s) of 4D field(s).
→resultCodelongintResult code.

PL_SetFields tells PrintList Pro what fields to print. Up to fifteen fields can be set at a time. Any 4D field type can be used.

Fields from related one tables may also be printed (see PL_SetFile). A separate call to PL_SetFields must be made to set these fields. To print a related one field, pass the table number of the related one table in the tableNum parameter.

This command is also used to print calculated columns. See Calculated Columns.

resultCode — The possible values are:

Constant Value Action
PL SetFile Passed0Reference of PrintList Pro object on layout
PL Not enough memory5Increase 4D’s RAM partition
PL Not a file6Check to make sure that the table represented by tableNum does exist
PL Not a field7The fieldNum passed is not a valid 4D field number
PL Wrong field type8The field passed cannot be used by PrintList because the field’s type is not supported
PL Maximum fields exceeded932767 fields is the maximum
PL Wrong 4D version10(obsolete)
PL Arrays have been set11You’ve attempted to set fields or a table when arrays have already been set

Examples

  // Set up the eList PrintList Pro object with 5 Fields, all from the same Table
  $error:=PL_SetFields(eList;Table(->[People]);1;5;Field(->[People]First Name);Field (->[People]Last Name);
  Field (->[People]Salary);Field (->[People]Arrival);Field (->[People]Male))
  // Set up the eList PrintList Pro object with 4 Fields, the third one from a related Table
  $error:=PL_SetFields(eList;Table(->[People]);1;2;Field(->[People]First Name);Field(->[People]Last Name))
  $error:=PL_SetFields(eList;Table(->[Companies]);3;1;Field(->[Companies]Company Name))
  $error: PL_SetFields(eList;Table(->[People]);4;1;Field(->[People]Salary))
  // Set up the eList PrintList Pro object with 4 Fields, the first one from a related Table
  $error:=PL_SetFile(eList;Table(->[People])) // set the main Table since the Field to be set in column one
  // is not from the main Table, but from a related one Table
  $error:=PL_SetFields(eList;Table(->[Companies]);1;1;Field(->[Companies]Company Name))
  $error:=PL_SetFields(eList;Table(->[People]);2;3;Field(->[People]First Name);\
  Field(->[People]Last Name); Field(->[People]Salary))
field_and_record_commands.txt · Last modified: 2017/06/28 15:31 by plp_admin