As designed or a bug?

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
pkoopmanpk
Posts: 49
Joined: Wed Apr 26, 2017 7:12 pm

As designed or a bug?

Post by pkoopmanpk »

In noticed some unexpected behaviour:

Code: Select all

Function Options(*DIRECT)

Define Field(#value1) Type(*INT)
Define Field(#value2) Type(*INT)
Define Field(#value3) Type(*INT)

#value1 := 1
#value2 := 2
#value3 := 3

#value1 #value2 #value3 := #value1 + #value2 + #value3

Use Builtin(MESSAGE_BOX_ADD) With_Args(('value1: &1').substitute( #value1.AsString ))
Use Builtin(MESSAGE_BOX_ADD) With_Args(('value2: &1').substitute( #value2.AsString ))
Use Builtin(MESSAGE_BOX_ADD) With_Args(('value3: &1').substitute( #value3.AsString ))
Use Builtin(MESSAGE_BOX_SHOW)
Results in:
2023-01-24 10_45_48-Window.jpg
2023-01-24 10_45_48-Window.jpg (4.29 KiB) Viewed 36845 times
I would expect for the evaluation to take place, and after that the result being assigned to all 3 values. But it looks like it's evaluated like:

Value1 := 1 + 2 + 3
Value2 := 6 + 2 + 3
Value3 := 6 + 11 + 3

Is this as designed, or is this a bug?
René Houba
Posts: 220
Joined: Thu Nov 26, 2015 7:03 am

Re: As designed or a bug?

Post by René Houba »

Hi Peter,

Tis is "as desgned" I think. I saw same issues likes this in the past.

I will check for you.
Theo de Bruin
Posts: 29
Joined: Wed Feb 10, 2016 8:41 pm

Re: As designed or a bug?

Post by Theo de Bruin »

This is the normal way the evaluation is done, once value1 is changed, the next eveluation will use the new value.
pkoopmanpk
Posts: 49
Joined: Wed Apr 26, 2017 7:12 pm

Re: As designed or a bug?

Post by pkoopmanpk »

Theo de Bruin wrote: Wed Jan 25, 2023 12:02 am This is the normal way the evaluation is done, once value1 is changed, the next eveluation will use the new value.
Thanks. Good to know that ASSIGN is executed for each variable in the list separately. The documentation doesn't mention this.
Post Reply