Kbase 18436: QUERY with WHERE CAN-FIND raises SE 3541
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  08/12/1998 |
|
QUERY with WHERE CAN-FIND raises SE 3541
DRAFT COPY - Currently under review and edit.
INTRODUCTION:
=============
Sometimes users want to see only customer records that have / do not
have related orders.
WHY YOU NEED TO KNOW THIS:
===========================
Records can be displayed by running a simple 4GL code like this:
FOR EACH customer WHERE /* NOT */ CAN-FIND (FIRST order OF customer)
NO-LOCK:
DISPLAY cust-num name.
END.
If a browser and a query are used instead, same WHERE clause raises
SE 3541:
CAN-FIND is invalid within an OPEN QUERY. (3541)
PROCEDURAL APPROACH:
====================
The following piece of code can be used to see customer records with /
without orders:
DEFINE QUERY q1 FOR customer.
DEFINE BROWSE b1 QUERY q1 DISPLAY cust-num name
WITH 17 DOWN TITLE "Customer Browse".
DEFINE FRAME f1
b1 WITH SIDE-LABELS AT ROW 2 COLUMN 2.
ON FIND OF customer DO:
IF /* NOT */ CAN-FIND(FIRST order OF customer) THEN RETURN ERROR.
END.
OPEN QUERY q1 FOR EACH customer NO-LOCK.
ENABLE b1 WITH FRAME f1.
WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW.
WARNING!!: Be very careful with persistent procedures. In this case
triggers overlay each other and results may not be what you expect.
This applies to SmartObjects; use SmartDialog which controls scoping
of a trigger (in this case FIND trigger).
ONLINE PROCEDURES OR UTILITIES:
===============================
REFERENCES TO WRITTEN DOCUMENTATION:
====================================
Programming Handbook ch. 10 Database Triggers
VZA 8 Dec 1998