Consultor Eletrônico



Kbase 17648: How LAST-OF Works (Clearing the Fog)
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/10/1998
How LAST-OF Works (Clearing the Fog)

INTRODUCTION:
=============
This knowledgebase entry describes how the LAST-OF function really
works when used with multiple fields in the BREAK BY list.

WHY YOU NEED TO KNOW THIS:
===========================
You need to know this if you are having a problem where you think
that the LAST-OF function for a given field should be false but is
returning true instead.

DETAILS:
========
When you have more than one field in the BREAK BY phrase in a query
the LAST-OF function returns true not only for the field whose value
changes but also for all fields listed to the right of that field in
the BREAK BY phrase.

Many people think that the LAST-OF function should only return true
for each field in the BREAK BY phrase when the value for that field
changes (without regards to any of the other fields listed in tbe
BREAK BY phrase). This belief is incorrect.

Given the following data and query:

Cust-Name Sales-Rep
========= =========
ABC Co. GRF
ABC Co. SLS
NOP Co. SLS

Table has a unique index containing Cust-Name and Sales-Rep.

FOR EACH CustInfo BREAK BY Cust-Name BY Sales-Rep:
DISPLAY Cust-Name LAST-OF(Cust-Name)
Sales-Rep LAST-OF(Sales-Rep).
END.

The results of the query are:

Cust-Name LAST-OF(Cust-Name) Sales-Rep LAST-OF(Sales-Rep)
========= ================== ========= ==================
ABC Co. No GRF Yes
ABC Co. Yes SLS Yes
NOP Co. Yes SLS Yes

Progress Software Technical Support Note # 17648