$empty

Return the empty frame status for an entity or named area frame.

$empty { (Frame) }

Parameters

Parameters
Parameter Data Type Description
Frame String Name of a named area frame or entity. If omitted, the current entity or its named area frame is used.

Return Values

Values Returned by $empty
Value 

Meaning

2 Frame contains only the empty default occurrence, and the printing property for Frame has Suppress Print if Empty turned on.
1 Frame contains only the empty default occurrence, and the printing property for Frame has Suppress Print if Empty turned off. .
0 The Frame contains at least one occurrence with data in it.
"" The Frame does not exist.

Use

Allowed in forms, reports, and dynamic and static server pages, and in services that are not self-contained.

Description

The function $empty allows you to determine whether the named area frame or entity specified by Frame is empty; that is, if it contains only the default empty occurrence and no data has been entered. If the default occurrence contains declarative initial values, it is still considered empty. An occurrence that was created with creocc is considered to be a user occurrence that contains data.

You can use the $empty function to determine whether to print a break frame when there is no data in Frame . This is often preferable to printing an empty entity or named area frame.

It makes most sense to test whether an entity has occurrences associated with it before you attempt to print it. For example, in the getFocus trigger of an outer entity, you can test whether any (or all) inner entities have occurrences associated with them.

Printing Break Frames Based on $empty

The following example prints the break frame NO_INVOICES if there are no occurrences of the inner entity INVOICES:

trigger getFocus ; of entity CUSTOMERS (the outer entity)
  if ($empty(INVOICES) = 2)
    printbreak "NO_INVOICES"
  endif
end; getFocus

Related Topics