ASSIGN operator <= vs :=

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
adale
Posts: 48
Joined: Wed Apr 08, 2020 9:18 pm
Location: Poplarville, MS

ASSIGN operator <= vs :=

Post by adale » Thu May 26, 2022 9:27 pm

Maybe I am just being daft, but can someone help give a bit more of an explanation as to when or why it is better to use the ASSIGN operator '<=' instead of the simple ':=' '?
Arlyn Dale
Servias Development & Support
Intelliware, Inc.

User avatar
Dino
Posts: 253
Joined: Fri Jul 19, 2019 7:49 am
Location: Robbinsville, NC
Contact:

Re: ASSIGN operator <= vs :=

Post by Dino » Thu May 26, 2022 10:15 pm

I guess all begin with C, but basically it depends on what the "parameter" (or the property or the attribute) it is calling for.

It can call for a reference (to another component, a "pointer") <=
or a plain simple value (string, number, Boolean, etc.). :=

So, for example if you use an "Alert control" in a Web Page (I called it #TEST555), properties like Width, Height, Top, Opacity, are expecting a Value and nothing more complex than that. You could use Intrinsics over that value to convert the numeric value to a String value using .AsString for example, you could perform calculations to obtain that value, but the value, let's say 400, at the end is just a value.

On the other hand, the property Parent, that one is not expecting a string value with the name of the Parent (which we could obtain with something like #TEST555.Name) but is expecting instead a reference to the Actual Parent. Is like a teacher asking a child for his Parent and the child only gives the name. We don't want just the name, we want access to the whole enchilada, name, phone, address, where he is now, what he looks like, etc. For that, this property Parent, is expecting a reference, call it, a child pointing to the actual Parent. that one. then, we can make the connection and talk with it and have access to whatever we need from that Parent.

Notice in the example code below, using the property Parent in Alert, I can access Parent properties and navigate thru them.

Code: Select all

#Alert.Width := 400
#STD_TEXT := #Alert.Width.AsString

#Alert.Parent <= #TEST555
#STD_TEXT := #Alert.Parent.DisplayPosition.AsDisplayString
#STD_TEXT := #Alert.Parent.HintTitle
#Alert.Parent.Rotation := 90

adale
Posts: 48
Joined: Wed Apr 08, 2020 9:18 pm
Location: Poplarville, MS

Re: ASSIGN operator <= vs :=

Post by adale » Fri May 27, 2022 4:22 am

That helps.
As always, thanks for the explanation and example.
Arlyn Dale
Servias Development & Support
Intelliware, Inc.

Post Reply