Closed JodyBevan closed 2 years ago
Hello Jody, Thanks for your contribution, and please feel free to post comments here or on the forums. To reply to your question, yes you can create objects with nested properties using this syntax. You can also create multi-level properties on a single line:
$o:=New object("a"; New object("b"; New object("c"; "hello"))) ALERT($o.a.b.c) //hello
What we would suggest is to avoid using interprocess variables (<>var) since they will prevent your code for running preemptive.
Kind regards, Doc team
Enter your comment here:
In your examples of using objects you rightly show examples with multiple dot notation: eg: $age:=$myObjVar.employee.age
What is not in your examples / explanation is how one creates such an object. I understand that to some this may seen obvious, but certainly not to all. I therefore had to write some code to figure out how to do this. Fortunately past use of objects helped point me in what I think is the right direction. What I did that got it to work is as follows:
C_OBJECT(<>vO_Var) <>vO_Var:=New object <>vO_Var.Name:=New object
<>vO_Var.Name.Surname:="Bevan" <>vO_Var.Name.Given:="Jody"
ALERT(<>vO_Var.Name.Given+" "+<>vO_Var.Name.Surname)
This worked, but is this correct, and the recommended way?
PS: If you do not want these types of comments of how I think the manual can be improved (from my perspective) let me know and I will keep them to myself, and not clutter up your in basket of work. I am not here to be a pest, but rather as another set of eyes and person coming from a less close view's understanding.
Thanks
Jody Bevan