PxPlus User Forum

Twitter Twitter Twitter

Author Topic: Addressing an object  (Read 598 times)

Stéphane Devouard

  • Diamond Member
  • *****
  • Posts: 122
  • PxPlus guru with skills in PHP, JS, C#, Java
    • View Profile
    • Stéphane's Web Resume
Addressing an object
« on: September 28, 2022, 10:46:08 AM »
Hi

This code returns an error 29 on line 581


Code: [Select]
0580 IF XL[J]=0 THEN XL[J]=NEW("*obj/xml")
0581 XLIG=XL[J]'ADD_NODE("ligne")

I told the boss to change it to :

Code: [Select]
0580 if xl[j]=0 xd=new("*obj/xml"); xl[j]=xd else xd=xl[j]
0581 xlig=xd'add_node("ligne")

And it worked

Looks like this type of syntax
Code: [Select]
array[index]'some_method() While valid, is not supported by the parser or compiler

That being said, we are on a V16 with V15 license, maybe it has been fixed in a more recent version ?

Regards
« Last Edit: September 28, 2022, 10:50:42 AM by Stéphane Devouard »
Stéphane Devouard
Portfolio | Work

Mike King

  • Diamond Member
  • *****
  • Posts: 3811
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: Addressing an object
« Reply #1 on: September 28, 2022, 11:14:24 AM »
Object handles, while they may be kept in an array must be referenced using a simple numeric variable.  You cannot access object properties/methods using a object handle in an array.
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com