Unable setting one extent from static property in "norm

Posted by Stefan Marquardt on 13-Apr-2011 10:02

Hello,

why this doesn't work ?

class:

define

public static property cValueArray as character no-undo extent 5

get.

set.

end

class.

Class:cValueArray[1] = "0".

This sets all extent to 0 and not only extent 1.

But within the static class cValueArray[1] = "0" works fine (as expected).

But this should work inside AND outside!

Workaround:

define variable cValueArray as character no-undo extent 5.

cValueArray = FormulaService:cValueArray.

cValueArray[1] = "0"

Class:cValueArray = cValueArray.

Stefan

All Replies

Posted by Peter Judge on 13-Apr-2011 10:15

marquardt wrote:

Hello,

why this doesn't work ?

class:

define

public static property cValueArray as character no-undo extent 5

get.

set.

end

class.

Class:cValueArray[1] = "0".

This sets all extent to 0 and not only extent 1.

But within the static class cValueArray[1] = "0" works fine (as expected).

But this should work inside AND outside!

Workaround:

define variable cValueArray as character no-undo extent 5.

cValueArray = FormulaService:cValueArray.

cValueArray[1] = "0"

Class:cValueArray = cValueArray.

Stefan

In 10.2B04, I tried

class ouch:

define public static property cValueArray as character no-undo extent 5 get. set.

end class.

Ouch:cValueArray[1] = "0".

MESSAGE

    Ouch:cValueArray[1] skip

    Ouch:cValueArray[2] skip

    Ouch:cValueArray[3] skip

    Ouch:cValueArray[4] skip

    Ouch:cValueArray[5] skip

    VIEW-AS ALERT-BOX INFO BUTTONS OK.

And I see:

---------------------------

Information (Press HELP to view stack trace)

---------------------------

0

---------------------------

OK   Help  

---------------------------

What version are you running? And does my code demonstrate the problem you're seeing? And if so, you should report it as a bug.

-- peter

Posted by Stefan Marquardt on 13-Apr-2011 10:41

Peter,

opened WR W104130068.

Running 10.2B04 (32bit) on Windows 7.

This is the full code:

do

iKey = 1 to 5:

if FormulaService:lDisplayArray[iKey] then

do:

iValue = integer(FormulaService:cKeyArray[iKey]).

if iValue > 0 then

do:

message

iKey skip

FormulaService:cValueArray[1] skip

FormulaService:cValueArray[2] skip

FormulaService:cValueArray[3] skip

FormulaService:cValueArray[4] skip

FormulaService:cValueArray[5] skip

view-as alert-box.

FormulaService:cValueArray[iKey] = buffer ttReceiptRowFormulaValue:buffer-field(substitute ("Value&1", iValue)):buffer-value ().

message

iKey skip

FormulaService:cValueArray[1] skip

FormulaService:cValueArray[2] skip

FormulaService:cValueArray[3] skip

FormulaService:cValueArray[4] skip

FormulaService:cValueArray[5] skip

view-as alert-box.

end.

end.

 

end.

Stefan

Posted by Stefan Marquardt on 14-Apr-2011 03:51

Peter,

this behaviour only happens when i assign a buffer value directly.

Workarund is using a variable (like bug  OE 00155893 described in P125455 which seems to need years for fixing).

using prohibisCash.Services.Formula.FormulaService from propath.
DEF VAR iKey AS INTEGER NO-UNDO.
DEF VAR iKeyValue AS  INT  NO-UNDO.
DEF VAR cValue AS CHAR NO-UNDO.
DEFINE TEMP-TABLE ttReceiptRowItem LIKE ReceiptRowItem.
DEFINE TEMP-TABLE ttReceiptRowFormulaValue LIKE ReceiptRowFormulaValue.
FIND LAST ReceiptRowItem WHERE ReceiptRowItem.ITEM = "KAS00302".
BUFFER-COPY ReceiptRowItem TO ttReceiptRowItem.
FIND ReceiptRow OF ReceiptRowItem.
FIND ReceiptRowFormulaValue OF ReceiptRow.
BUFFER-COPY ReceiptRowFormulaValue TO ttReceiptRowFormulaValue.
FormulaService:SetEntryFields (ttReceiptRowItem.ITEM).
DO iKey = 1 TO 5:   
    if FormulaService:lDisplayArray[iKey] then
        do:
          iKeyValue = integer(FormulaService:cKeyArray[iKey]).
          if iKeyValue > 0 then 
          do:  
              cValue = buffer ttReceiptRowFormulaValue:buffer-field(substitute ("Value&1", iKeyValue)):buffer-value ().
              message
                iKey cValue SKIP
                FormulaService:cValueArray[1] skip
                FormulaService:cValueArray[2] skip
                FormulaService:cValueArray[3] skip
                FormulaService:cValueArray[4] skip
                FormulaService:cValueArray[5] skip
                view-as alert-box.
                /* This sets all Extents */
                /* FormulaService:cValueArray[iKey] = buffer ttReceiptRowFormulaValue:buffer-field(substitute ("Value&1", iKeyValue)):buffer-value ().  */
                /* This sets only Extent iKey as expected */
                FormulaService:cValueArray[iKey] = cValue.
             MESSAGE
              iKey cValue SKIP
              FormulaService:cValueArray[1] skip
              FormulaService:cValueArray[2] skip
              FormulaService:cValueArray[3] skip
              FormulaService:cValueArray[4] skip
              FormulaService:cValueArray[5] skip
             view-as alert-box.
          END.
    END.
END.

What is wrong with this?

Workarund is using a variable (like bug OE 00155893 described in P125455 which seems to need years for fixing).

(or setting property without [])


Stefan

Posted by Stefan Marquardt on 19-Apr-2011 00:57

It's a bug(again) !

OE00206787

Posted by Stefan Marquardt on 19-Apr-2011 07:18

ID: P186122
Title: "Cannot assign an array element directly from a buffer value."
Created: 04/18/2011Last Modified: 04/18/2011
Status: Unverified

Very funny - unverified  ...

Posted by stevenseagal008 on 21-Apr-2011 18:09

Have you ever seen a "verified" one? Lol

Posted by Thomas Mercer-Hursh on 21-Apr-2011 18:32

It is verified when PSC has tested it internally.  Perfectly sensible.

Posted by stevenseagal008 on 22-Apr-2011 09:48

Hmm over 1,000 results for "unverified bug#" in my desktop version of ProKB.  So they can verify bugs without testing?  Impressive!

This thread is closed