# Can i change transforms in a list of robtargets?

**URL:** <https://tech-community.robotics.abb.com/t/can-i-change-transforms-in-a-list-of-robtargets/8962>\
**Category:** RAPID Programming\
**Created:** [July 11, 2019, 11:03am UTC](https://tech-community.robotics.abb.com/t/can-i-change-transforms-in-a-list-of-robtargets/8962 "2019-07-11T11:03:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![k\_schmid](https://avatars.discourse-cdn.com/v4/letter/k/a5b964/32.png) [@k\_schmid](https://tech-community.robotics.abb.com/u/k_schmid)\
**Post date:** [July 11, 2019, 11:03am UTC](https://tech-community.robotics.abb.com/t/can-i-change-transforms-in-a-list-of-robtargets/8962/1 "2019-07-11T11:03:01Z")

</div>

I am trying to get rid of globals and typing names in my program.  
I want to change transforms of some targets

CONST string targetnames{5}:=[“Target\_R11\_10”,“Target\_R11\_40”,“Target\_R11\_30”,“Target\_R11\_20”,“Target\_R11\_50”];

GetDataVal targetnames{1},current\_robtarg1;! Is this a copy?  
current\_robtarg1.trans.z:=current\_robtarg1.trans.z + z; ! will this change Target\_R11\_10?  
Whats the best way to do it?

Are there global variables between tasks?

Also, anyway to reference tools and workobjects without names?  
Thanks so much

---

<div class="post-metadata">

**Author:** ![lemster68](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/lemster68/32/1945_2.png) [@lemster68](https://tech-community.robotics.abb.com/u/lemster68)\
**Post date:** [July 11, 2019, 12:20pm UTC](https://tech-community.robotics.abb.com/t/can-i-change-transforms-in-a-list-of-robtargets/8962/2 "2019-07-11T12:20:12Z")

</div>

> [@k\_schmid](#):
>
> I am trying to get rid of globals and typing names in my program.  
> I want to change transforms of some targets
> 
> CONST string targetnames{5}:=[“Target\_R11\_10”,“Target\_R11\_40”,“Target\_R11\_30”,“Target\_R11\_20”,“Target\_R11\_50”];
> 
> This needs to be PERS, you cannot write a value to a CONST. Also, must be PERS in all tasks for tasks to access the values and change them.
> 
> GetDataVal targetnames{1},current\_robtarg1;! Is this a copy?  
> You need to declare this.
> 
> current\_robtarg1.trans.z:=current\_robtarg1.trans.z + z; ! will this change Target\_R11\_10?  
> Whats the best way to do it?
> 
> Target\_R11\_10.trans.z:=current\_robtarg1.trans.z + z; ! will this change Target\_R11\_10?
> 
> This will.
> 
> Are there global variables between tasks?
> 
> Also, anyway to reference tools and workobjects without names?  
> I have to think about that some.
> 
> Thanks so much

---

<div class="post-metadata">

**Author:** ![k\_schmid](https://avatars.discourse-cdn.com/v4/letter/k/a5b964/32.png) [@k\_schmid](https://tech-community.robotics.abb.com/u/k_schmid)\
**Post date:** [July 11, 2019, 1:04pm UTC](https://tech-community.robotics.abb.com/t/can-i-change-transforms-in-a-list-of-robtargets/8962/3 "2019-07-11T13:04:39Z")

</div>

Wait: CONST string targetnames are just names for lookup, the targets are PERS…, not writing to that array.

GetDataVal targetnames{1},current\_robtarg1;! Is this a copy?

Is declared of course.

So is GetDataVala making a copy of my target implicitly? How do i reference a target without making a copy if it is?

---

<div class="post-metadata">

**Author:** ![lemster68](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/lemster68/32/1945_2.png) [@lemster68](https://tech-community.robotics.abb.com/u/lemster68)\
**Post date:** [July 11, 2019, 1:42pm UTC](https://tech-community.robotics.abb.com/t/can-i-change-transforms-in-a-list-of-robtargets/8962/4 "2019-07-11T13:42:26Z")

</div>

I see, my oversight about just target names. No, it does not make a copy, per se, it writes the values from the target into the destination variable.

---

<div class="post-metadata">

**Author:** ![k\_schmid](https://avatars.discourse-cdn.com/v4/letter/k/a5b964/32.png) [@k\_schmid](https://tech-community.robotics.abb.com/u/k_schmid)\
**Post date:** [July 11, 2019, 8:59pm UTC](https://tech-community.robotics.abb.com/t/can-i-change-transforms-in-a-list-of-robtargets/8962/5 "2019-07-11T20:59:57Z")

</div>

Great thanks

---

<div class="post-metadata">

**Author:** ![Micky](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@Micky](https://tech-community.robotics.abb.com/u/Micky)\
**Post date:** [July 12, 2019, 11:04am UTC](https://tech-community.robotics.abb.com/t/can-i-change-transforms-in-a-list-of-robtargets/8962/6 "2019-07-12T11:04:35Z")

</div>

Hello,  
GetDataVal copies the value of the data declaration into a variable.  
If you modify the copied data, you have to use SetDataVal to write the new value back into the named data declaration.

/Br  
Micky

---

<div class="post-metadata">

**Author:** ![k\_schmid](https://avatars.discourse-cdn.com/v4/letter/k/a5b964/32.png) [@k\_schmid](https://tech-community.robotics.abb.com/u/k_schmid)\
**Post date:** [July 12, 2019, 11:09am UTC](https://tech-community.robotics.abb.com/t/can-i-change-transforms-in-a-list-of-robtargets/8962/7 "2019-07-12T11:09:13Z")

</div>

Ah thanks so much, I check that
