# How can I create an dynamic array in URSCRIPT or is it possible to create?

**URL:** <https://forum.universal-robots.com/t/how-can-i-create-an-dynamic-array-in-urscript-or-is-it-possible-to-create/8695>\
**Category:** URScript\
**Created:** [September 7, 2020, 7:14am UTC](https://forum.universal-robots.com/t/how-can-i-create-an-dynamic-array-in-urscript-or-is-it-possible-to-create/8695 "2020-09-07T07:14:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon4832633](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@anon4832633](https://forum.universal-robots.com/u/anon4832633)\
**Post date:** [September 7, 2020, 7:14am UTC](https://forum.universal-robots.com/t/how-can-i-create-an-dynamic-array-in-urscript-or-is-it-possible-to-create/8695/1 "2020-09-07T07:14:42Z")

</div>

i=1251  
a[i]  
j=0  
while j\<1251:  
a[j]=j  
j=j+1  
end

---

<div class="post-metadata">

**Author:** ![sam.verity-hilton](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/sam.verity-hilton/32/6046_2.png) [@sam.verity-hilton](https://forum.universal-robots.com/u/sam.verity-hilton)\
**Post date:** [September 7, 2020, 8:45am UTC](https://forum.universal-robots.com/t/how-can-i-create-an-dynamic-array-in-urscript-or-is-it-possible-to-create/8695/2 "2020-09-07T08:45:18Z")

</div>

Frustratingly, creation of an empty array of a given size is not functionality that is natively available in polyscope. Fortunately, there has been a workaround posted as part of [this thread](https://forum.universal-robots.com/t/urscript-initialise-array-of-given-length/6869). It requires a setting up an XML-RPC call that returns an array of the required size. I put together a [feature requrest](https://forum.universal-robots.com/t/better-array-manipulation/4565/2) about gett better array functionality natively in polyscope a while ago, if you could drop a like there to get it more attention it would be appreaciated.

Hope this helps.

---

<div class="post-metadata">

**Author:** ![anon4832633](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@anon4832633](https://forum.universal-robots.com/u/anon4832633)\
**Post date:** [September 7, 2020, 9:39am UTC](https://forum.universal-robots.com/t/how-can-i-create-an-dynamic-array-in-urscript-or-is-it-possible-to-create/8695/3 "2020-09-07T09:39:23Z")

</div>

Thank you Sam for your kind interest.

---

<div class="post-metadata">

**Author:** ![mbush](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/mbush/32/76_2.png) [@mbush](https://forum.universal-robots.com/u/mbush)\
**Post date:** [September 8, 2020, 2:12am UTC](https://forum.universal-robots.com/t/how-can-i-create-an-dynamic-array-in-urscript-or-is-it-possible-to-create/8695/4 "2020-09-08T02:12:06Z")

</div>

We have a script file that allows you to dynamically build an array of a given size up to around 250 elements. It also allows you to prefill the elements with a value so you can create Boolean, number or pose arrays.

We used a JavaScript program to create the file. It’s a silly workaround but it works and it doesn’t add much overhead to the program. You can find the script file in the thread mentioned above.

We also have the ability to return an array via XMLRPC.

---

<div class="post-metadata">

**Author:** ![anon4832633](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@anon4832633](https://forum.universal-robots.com/u/anon4832633)\
**Post date:** [September 8, 2020, 11:53am UTC](https://forum.universal-robots.com/t/how-can-i-create-an-dynamic-array-in-urscript-or-is-it-possible-to-create/8695/5 "2020-09-08T11:53:06Z")

</div>

Thank you mbush I will search about XMLRPC most of the keywords for dynamic array is releated with it

---

<div class="post-metadata">

**Author:** ![thomas.breitweg](https://avatars.discourse-cdn.com/v4/letter/t/53a042/32.png) [@thomas.breitweg](https://forum.universal-robots.com/u/thomas.breitweg)\
**Post date:** [May 18, 2021, 6:38am UTC](https://forum.universal-robots.com/t/how-can-i-create-an-dynamic-array-in-urscript-or-is-it-possible-to-create/8695/6 "2021-05-18T06:38:41Z")

</div>

Will this functionality come with an update in the future?

---

<div class="post-metadata">

**Author:** ![sam.verity-hilton](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/sam.verity-hilton/32/6046_2.png) [@sam.verity-hilton](https://forum.universal-robots.com/u/sam.verity-hilton)\
**Post date:** [May 18, 2021, 8:33am UTC](https://forum.universal-robots.com/t/how-can-i-create-an-dynamic-array-in-urscript-or-is-it-possible-to-create/8695/7 "2021-05-18T08:33:17Z")

</div>

I do hope so, until then all you can do is like the feature requiest post to help show that its functionality that people want.
