I have a STRUCT called "Cartridge" that has values.
I have a FB called "Gripper"
The gripper has a property called "CurrentCartridge" that holds and instance of Cartridge.
In the program, I want to access the status of the current cartridge.
If I type this statement:
IF Gripper1.CurrentCartridge.Status = CartridgeStatus.Inspected THEN Robot.PlaceWeld(1);END_IF
I get the error: It is not possible to perform component access '.', index access '[]' or call '()' on result of function call. Assign result to help variable first.
However, if I assign this to a variable, it works:
G1Cartridge := Gripper1.CurrentCartridge;IF G1Cartridge.Status = CartridgeStatus.Inspected THEN Robot.PlaceWeld(1);END_IF
Is there a proper way to do it the first way? this seems really annoying.
Thank you!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The same works with arrays. Of course, this only works if you have a backing variable to refer to, if you're creating it on the fly, you'll have to use helper variables.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all,
I've got a structure set up in this way:
I have a STRUCT called "Cartridge" that has values.
I have a FB called "Gripper"
The gripper has a property called "CurrentCartridge" that holds and instance of Cartridge.
In the program, I want to access the status of the current cartridge.
If I type this statement:
I get the error:
It is not possible to perform component access '.', index access '[]' or call '()' on result of function call. Assign result to help variable first.
However, if I assign this to a variable, it works:
Is there a proper way to do it the first way? this seems really annoying.
Thank you!
You can maybe get around this by using a REFERENCE TO in your property. So your property could look like this:
The same works with arrays. Of course, this only works if you have a backing variable to refer to, if you're creating it on the fly, you'll have to use helper variables.
Awesome! That's exactly what I was looking for Thank you!
Awesome! That's exactly what I was looking for Thank you!