Losing record

Dave Grandon

New Member
Can anyone explain the following behaviour please?

MESSAGE 1.5 AVAILABLE debtor
VIEW-AS ALERT-BOX.
RUN SET-ATTRIBUTE-LIST IN h_q-debtordiary ("debtor=" + trim(STRING(Debtor.debtorid))).
MESSAGE 1.6 AVAILABLE debtor
VIEW-AS ALERT-BOX.

Message 1.5 returns yes however message 1.6 returns no and i cannot find anything to explain this in the documentation or prokb so thought I would ask here.
Cjeers
 

TomBascom

Curmudgeon
It seems fairly apparent that SET-ATTRIBUTE-LIST must do something to the availability of the buffer. Since you aren’t showing the code for that I can only guess but my guess is that it RELEASE’d it after updating it.
 

Dave Grandon

New Member
set-attribute-list is standard functionality and does not appear to touch a buffer as it is just being used to pass a value from what I can see. What code were you expecting to see, the 5 lines I originally posted are as cut from the main routine
 

TomBascom

Curmudgeon
“Standard functionality” isn’t a free pass. I have no idea what it does nor how it is coded. But the buffer was available before it ran and is unavailable immediately after it runs. That sure looks like a “smoking gun” to me but if you want it to be something else you’re going to have show a lot more code than you have so far.

FWIW I would comment out “run set-attribute-list …” and see if the buffer still becomes unavailable. That should remove all doubt.
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
I had never heard of set-attribute-list so I looked it up. It is the name of an internal procedure in a Progress procedure, web2/admweb.p; maybe in other code too. It might look something like this:
Code:
PROCEDURE set-attribute-list :
/* ---------------------------------------------------------------------
  Purpose:    Accepts the value of the complete object attribute list and
              runs procedures to set individual attributes.
  Parameters (INPUT):
              p-attr-list (CHAR)- comma-separated attribute list with the
                format "name=value".  Typical attributes are web-timeout,
                web-state, and web-timeout-handler.  In addition, other names
                can be used provided the special-get-attribute procedure
                exists in the target procedure to handle them.
  Notes:      Not all attributes are settable. Those which are a part of an
              event such as enable/disable (which set ENABLED on/off) or
              hide/view (which set HIDDEN on/off) can be queried through
              get-attribute, but are read-only.
------------------------------------------------------------------------*/
  DEFINE INPUT PARAMETER p-attr-list    AS CHARACTER NO-UNDO.

  DEFINE VARIABLE cntr       AS INTEGER   NO-UNDO.
  DEFINE VARIABLE attr-name  AS CHARACTER NO-UNDO.
  DEFINE VARIABLE attr-value AS CHARACTER NO-UNDO.
  DEFINE VARIABLE attr-entry AS CHARACTER NO-UNDO.

  DO cntr = 1 TO NUM-ENTRIES(p-attr-list):
    attr-entry = ENTRY(cntr, p-attr-list).
    IF INDEX(attr-entry,"=":U) = 0 THEN DO:
      MESSAGE
        "Invalid element in set-attribute call:" SKIP
        attr-entry SKIP "in" TARGET-PROCEDURE:FILE-NAME
        VIEW-AS ALERT-BOX WARNING.
      NEXT.
    END.

    ASSIGN
      attr-name      = TRIM(ENTRY(1,attr-entry,"=":U))
      attr-value     = TRIM(ENTRY(2,attr-entry,"=":U))
      .
    CASE attr-name:
      WHEN "Web-Timeout":U         THEN {set WebTimeout DECIMAL(attr-value)}.
      WHEN "Web-State":U           THEN {set WebState   attr-value}.
      WHEN "Web-Timeout-Handler":U THEN {set WebToHdlr  attr-value}.
      OTHERWISE
        RUN special-set-attribute IN TARGET-PROCEDURE
          (attr-name, INPUT attr-value) NO-ERROR.
    END CASE.
  END. /* DO... */

END PROCEDURE.
So as I read it, if the above were your code, your call with "debtor=<string_of_some_id> would fall into the OTHERWISE block of the CASE statement and run an IP called special-set-attribute in some other procedure. But we don't know what's going on for you because we don't know what code this handle "h_q-debtordiary" actually points to or what it does.

Having said all that, I don't think the above is your main problem. Rather, I think it is one symptom of your problem. And likely next week or next month, you'll have some other manifestation of this problem where you scratch your head and wonder "why the heck is my code doing what it's doing?"

Your problem is that you are trying to debug your code but you are doing it with poor man's tools, like MESSAGE statements, or maybe ETIME and the like. I've been there. I started in an organization where what you are currently doing was considered "debugging" and no one knew or used the debugging and diagnostic tools available in the OE platform. That old approach is time-consuming and frustrating and very limiting. But if you have the right tools and learn to use them it can be a lot quicker and easier. It might take you some time to accomplish this, and maybe you'll have challenges like getting licenses or learning to be productive with the tools, but it is well worth the time investment.

Launch your code from a properly-configured debugger and put a breakpoint at your RUN statement; you will see where "h_q-debtordiary" leads and what it does with its parameter. As you step through the code you will see your AVM state change, line by line, including record buffers going in and out of scope. It should quickly become obvious what is happening to your debtor record.
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
One final note: it looks like set-attribute-list is not unique; there are internal procedures with this name implemented in several different OpenEdge libraries.
 
Top