# array of workobjects

**URL:** <https://tech-community.robotics.abb.com/t/array-of-workobjects/8675>\
**Category:** RAPID Programming\
**Created:** [January 28, 2019, 2:38pm UTC](https://tech-community.robotics.abb.com/t/array-of-workobjects/8675 "2019-01-28T14:38:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sort](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@sort](https://tech-community.robotics.abb.com/u/sort)\
**Post date:** [January 28, 2019, 2:38pm UTC](https://tech-community.robotics.abb.com/t/array-of-workobjects/8675/1 "2019-01-28T14:38:05Z")

</div>

Hello,  
I cannot find any refference in the rapid manual for this so I am trying to find the answer here.

I have multiple workobjects that I would like to store in an array like this:

TASK PERS wobjdata wObj1:=[FALSE,TRUE,“”,[[181.197,632.58,297.741],[0.999992,0.00251573,0.000730156,0.00299524]],[[0,0,0],[1,0,0,0]]];  
TASK PERS wobjdata wObj2:=[FALSE,TRUE,“”,[[181.197,632.58,297.741],[0.999992,0.00251573,0.000730156,0.00299524]],[[0,0,0],[1,0,0,0]]];  
TASK PERS wobjdata wObj3:=[FALSE,TRUE,“”,[[181.197,632.58,297.741],[0.999992,0.00251573,0.000730156,0.00299524]],[[0,0,0],[1,0,0,0]]];  
… and so son

PERS wobjdata arrayofObj{3}:=[wObj1,wObj2,wObj3,…]

I am getting syntax error that says: Expected num but found identifier. I suppose I cannot do it this way. I know I can do it like this with robtargets so I thought that I can do it with work objects but I can’t. Is there any way how to do it?

thanks for the help

---

<div class="post-metadata">

**Author:** ![soup](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/soup/32/1592_2.png) [@soup](https://tech-community.robotics.abb.com/u/soup)\
**Post date:** [January 28, 2019, 4:25pm UTC](https://tech-community.robotics.abb.com/t/array-of-workobjects/8675/2 "2019-01-28T16:25:49Z")

</div>

Array of strings and check out [ArgName](http://developercenter.robotstudio.com/BlobProxy/manuals/RapidIFDTechRefManual/doc317.html).

---

<div class="post-metadata">

**Author:** ![innebandy](https://avatars.discourse-cdn.com/v4/letter/i/67e7ee/32.png) [@innebandy](https://tech-community.robotics.abb.com/u/innebandy)\
**Post date:** [January 28, 2019, 11:47pm UTC](https://tech-community.robotics.abb.com/t/array-of-workobjects/8675/3 "2019-01-28T23:47:15Z")

</div>

Putting identifiers in array is not allowed. You should keep data structure of wobjdata in a array as follows.

TASK PERS wobjdata wobj\_array{3}:=[[FALSE,TRUE,“”,[[700,-500,570],[1,0,0,0]],[[0,0,0],[1,0,0,0]]],[FALSE,TRUE,“”,[[0,0,0],[1,0,0,0]],[[0,0,0],[1,0,0,0]]],[FALSE,TRUE,“”,[[0,0,0],[1,0,0,0]],[[0,0,0],[1,0,0,0]]]];

---

<div class="post-metadata">

**Author:** ![soup](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/soup/32/1592_2.png) [@soup](https://tech-community.robotics.abb.com/u/soup)\
**Post date:** [January 29, 2019, 4:54pm UTC](https://tech-community.robotics.abb.com/t/array-of-workobjects/8675/4 "2019-01-29T16:54:47Z")

</div>

Here’s a [previous post](https://forums.robotstudio.com/discussion/comment/27549) which might help.

---

<div class="post-metadata">

**Author:** ![sort](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@sort](https://tech-community.robotics.abb.com/u/sort)\
**Post date:** [January 31, 2019, 8:32am UTC](https://tech-community.robotics.abb.com/t/array-of-workobjects/8675/5 "2019-01-31T08:32:48Z")

</div>

I found that post here is how I did it and it’s working.  
CONST STRING wobjArray{10}:=[“productA”,“productB”,“productC”…];

VAR wobjdata actualWobjTemp;  
PERS wobjdata actualWobj;  
…  
GetDataVal wobjArray{i},actualWobjTemp;  
actualWobj:=actualWobjTemp;

MoveJ p201,v1000,z50,tGripper\WObj:=actualWobj;

Identifiers in array is not allowed but with robtargets it is working

---

<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:** [January 31, 2019, 4:47pm UTC](https://tech-community.robotics.abb.com/t/array-of-workobjects/8675/6 "2019-01-31T16:47:48Z")

</div>

> [@sort](#):
>
> Identifiers in array is not allowed but with robtargets it is working

It does work, but if you really want to see something that will blow your mind, put robtarget names into a CONST array. Then try to modpos one of the named positions. It won’t work, and won’t tell you why. It is actually a way one could lock down positions that you absolutely don’t want to be modified. You would have to comment out the array, modify positions, and then uncomment the array.
