Xbasic

BLANK_DUPLICATE Function

Syntax

A blank_duplicate(A subexpr[,G over[,G each])

Arguments

subexpr

Any valid expression that includes a field or a combination of fields from the current table or set that specifies what you want to examine. Any type

over

Optional. When to use the function (instead of on every record).

each

Optional. When to reset the value produced by the function to 0 (instead at the end of all records). The Group and Sub_Group are optional parameters that define the range of records to summarize, and may or may not be required, depending upon the context of the summary calculation. Possible values for GRP >Group and GRP >Sub Group include:

GRAND (all records)
The name of the current table.
The name of a table in the current set
The name of a grouping level that is defined in a report layout.
DETAIL (over the records in the detail section)

Description

Blank any duplicates of subexpression over group 'over' sampled each group 'each'

Discussion

BLANK_DUPLICATE() removes repeating instances of a field value that occur in a sequence of two or more records. The Expression is evaluated for all the records in the Sub_Group that are related to the current record of the Group, and if two or more records have identical expression values. Only the first record's value is returned; the other duplicate records return a blank (empty) string. For example, to summarize the line-items in an invoice set, the Group parameter might be GRP >INV_HEAD and the Sub_Group parameter GRP >INV_ITEM. This means the Summary operation includes only those child records in INV_ITEM related to the current parent record in the Inv_head table. To summarize all the records in a table or set, use the name GRAND as the Group name. The group GRP >GRAND and sub-group GRP >INV_ITEM produce a summary result based on all invoices. If you use this summary function in a report layout, the group name can be the name assigned to any of the report's grouping levels. This function is a report writer function, not intended for table level field rules or other expressions. While the function may perform in some areas outside of the Report Editor, its use there is not supported.

Example

Assume that you have a customer table for which you want like to create a report listing all your customers by state, showing the state next to the name only in the first instance of a new state. Instead of placing the bill_state_region field in the report, create and place the following calculated field:

blank_duplicate(CUSTOMER->STATE, GRP ->GRAND)

The report with the bill_state_region and bill_city fields.

images/UG_Using_Blank_Duplicate_4.gif

Previewing the report.

images/UG_Using_Blank_Duplicate_3.gif

The report with the a calculated field substituted for bill_state_region.

images/UG_Using_Blank_Duplicate_1.gif

Previewing the report.

images/UG_Using_Blank_Duplicate_2.gif

Limitations

This function is a report writer function, not intended for table level field rules or other expressions.

See Also