# RAPID: Modify variable in an array from FlexPendant

**URL:** <https://tech-community.robotics.abb.com/t/rapid-modify-variable-in-an-array-from-flexpendant/5582>\
**Category:** Robot Controller\
**Tags:** array, rapid, robtarget, modify\
**Created:** [June 27, 2013, 12:13pm UTC](https://tech-community.robotics.abb.com/t/rapid-modify-variable-in-an-array-from-flexpendant/5582 "2013-06-27T12:13:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![greenvirag](https://avatars.discourse-cdn.com/v4/letter/g/db5fbb/32.png) [@greenvirag](https://tech-community.robotics.abb.com/u/greenvirag)\
**Post date:** [June 27, 2013, 12:13pm UTC](https://tech-community.robotics.abb.com/t/rapid-modify-variable-in-an-array-from-flexpendant/5582/1 "2013-06-27T12:13:39Z")

</div>

I have a single robtarget (called A) and an array of robtargets (called B). I would like to put A into B → this works nicely, until I would like to modify A via FlexPendant: I get the “Unable to modify position” error message. The ways I tried:

(1) Result: Error message while modifying via FlexPendant (“Unable to modify”)  
CONST robtarget A:=[…];

CONST robtarget B{1}:=[A];

(2) Result: Error in rapid code (B cannot be declared as PERS)  
CONST robtarget A:=[…];

PERS robtarget B{1}:=[A];

(3) Result: Error in rapid code (A should be CONST if we want to put it into an array)

PERS robtarget A:=[…];

CONST robtarget B{1}:=[A];

I have to put robtargets into an array, but I would like to provide the “Modify position via FlexPendant” feature to the operators. Is this possible some way?

Thank you for any help.

---

<div class="post-metadata">

**Author:** ![blueberry](https://avatars.discourse-cdn.com/v4/letter/b/54ee81/32.png) [@blueberry](https://tech-community.robotics.abb.com/u/blueberry)\
**Post date:** [September 23, 2013, 8:15am UTC](https://tech-community.robotics.abb.com/t/rapid-modify-variable-in-an-array-from-flexpendant/5582/2 "2013-09-23T08:15:19Z")

</div>

you can but they ALL need to be PERS, I don’t think rapid let you modify CONST unless in manual. Try this:

VAR robtarget pTemp := [whatever, just make sure the position is clear]

GetDataVal “pRobTargetB”, pTemp;

MoveL pTemp…

After the changes have been made and saved run this

SetDataVal “pRobTargetA”, pTemp;

pRobTargetB := pTemp;

I hope this help! Now this is set up without the array, so you may need to run a for loop to pull the robtarget out of the array before making pRobTargetB := pTemp
