KMoody
Member
I want to make a constant available throughout my code, so I created a static customer_util class containing a static property.
However, when I invoke PROSPECT_CODE in a FIND or FOR loop, I never find anything - even though I know I have records that meet my condition. Instead of a static property, I have to use a hard-coded value.
For example, this fails:
This does not:
Is there some static class subtlety that I'm missing? Is this a known bug?
Code:
USING Progress.Lang.*.
CLASS customer_util:
DEFINE STATIC TEMP-TABLE tt_FAKE_CUSTOMER_NUM no-undo
FIELD cust-num LIKE CUSTOMER.CUST-NUM.
DEFINE PUBLIC STATIC PROPERTY PROSPECT_CODE AS CHARACTER INITIAL 'HP' NO-UNDO
GET.
/*------------------------------------------------------------------------------
Purpose:
Notes:
------------------------------------------------------------------------------*/
CONSTRUCTOR STATIC customer_util ( ):
DEF VAR i AS INTEGER FORMAT "99" INIT 0.
FIND FIRST tt_FAKE_CUSTOMER_NUM NO-LOCK NO-ERROR.
IF NOT AVAILABLE tt_FAKE_CUSTOMER_NUM THEN
DO:
DO i = 1 TO 99:
CREATE tt_FAKE_CUSTOMER_NUM.
IF i < 10 THEN
tt_FAKE_CUSTOMER_NUM.cust-num = " 0" + STRING(i).
ELSE
tt_FAKE_CUSTOMER_NUM.cust-num = " " + STRING(i).
/* MESSAGE tt_FAKE_CUSTOMER_NUM.cust-num .*/
RELEASE tt_FAKE_CUSTOMER_NUM.
END.
END.
END CONSTRUCTOR.
END CLASS.
However, when I invoke PROSPECT_CODE in a FIND or FOR loop, I never find anything - even though I know I have records that meet my condition. Instead of a static property, I have to use a hard-coded value.
For example, this fails:
Code:
FIND customer WHERE CUSTOMER.ACCT-STATUS ne customer_util:PROSPECT_CODE
AND customer.cust-num = cust NO-LOCK NO-ERROR.
Code:
FIND customer WHERE CUSTOMER.ACCT-STATUS ne 'HP'
AND customer.cust-num = cust NO-LOCK NO-ERROR.
Is there some static class subtlety that I'm missing? Is this a known bug?