# Array problem?

**URL:** <https://tech-community.robotics.abb.com/t/array-problem/6934>\
**Category:** Developer Tools\
**Created:** [December 17, 2015, 3:09pm UTC](https://tech-community.robotics.abb.com/t/array-problem/6934 "2015-12-17T15:09:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![guds](https://avatars.discourse-cdn.com/v4/letter/g/d9b06d/32.png) [@guds](https://tech-community.robotics.abb.com/u/guds)\
**Post date:** [December 17, 2015, 3:09pm UTC](https://tech-community.robotics.abb.com/t/array-problem/6934/1 "2015-12-17T15:09:44Z")

</div>

I try to convert some of our earlier programs from pcsdk.5.10 to pcsdk.6.02.01 but encounter a problem.

The code below is to set the value of a Num Array in the controller.

These codes work fine with pcsdk.5.10, however, it just don’t work when I replace the dll with pcsdk 6.02.01 under Windows 7 64-bit (.net4.5 VS2012).

**_No error or exception appear but the values in controller remain unchanged._**

I think these codes are very similar to those in the pcsdk example document.

Does anyone has an idea about what is going on?

Num rapidNum1;  
Num rapidNum2;

RapidData rd = controller.Rapid.GetTask(“T\_ROB1”).GetModule("MainModule).GetRapidData("varArray1);  
ArrayData ad = (ArrayData)rd.Value;

rapidNum1.Value = 123.45;

rapidNum2.Value = 678.90;

ad[0] =rapidNum1;

ad[1] =rapidNum2;

rd.Value= ad;

---

<div class="post-metadata">

**Author:** ![Pavel\_Riabichev](https://avatars.discourse-cdn.com/v4/letter/p/8e7dd6/32.png) [@Pavel\_Riabichev](https://tech-community.robotics.abb.com/u/Pavel_Riabichev)\
**Post date:** [December 18, 2015, 12:02pm UTC](https://tech-community.robotics.abb.com/t/array-problem/6934/2 "2015-12-18T12:02:30Z")

</div>

Hi

Did you mouseover the variable in RAPID and checked ‘Current value’ from the mouseover dialog, sometimes the visual value is not refreshed.

/Pavel

---

<div class="post-metadata">

**Author:** ![guds](https://avatars.discourse-cdn.com/v4/letter/g/d9b06d/32.png) [@guds](https://tech-community.robotics.abb.com/u/guds)\
**Post date:** [December 18, 2015, 3:59pm UTC](https://tech-community.robotics.abb.com/t/array-problem/6934/3 "2015-12-18T15:59:59Z")

</div>

Hi,

Thanks for your reply.

Yes, on flexpendent I always press “Refresh” button before visually reading the value to avoid this problem.

And in PC environment (VS2012) I can always read the corresponding value after changing the value in flexpendent.

So I assume that “rd.value=xxxx” works for Num and String but doesn’t work for Array in pcsdk.6.02.01???

---

<div class="post-metadata">

**Author:** ![John\_Verheij](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/john_verheij/32/1724_2.png) [@John\_Verheij](https://tech-community.robotics.abb.com/u/John_Verheij)\
**Post date:** [February 17, 2016, 4:53pm UTC](https://tech-community.robotics.abb.com/t/array-problem/6934/4 "2016-02-17T16:53:21Z")

</div>

For editing an array, I use the WriteItem method. In your case it will be something like:

rd.WriteItem(rapidNum1, 0);  
rd.WriteItem(rapidNum2, 1);

To be sure your array is defined as PERS? Maybe you can try if this is a solution…

---

<div class="post-metadata">

**Author:** ![baijun](https://avatars.discourse-cdn.com/v4/letter/b/e0b2c6/32.png) [@baijun](https://tech-community.robotics.abb.com/u/baijun)\
**Post date:** [October 11, 2016, 1:08am UTC](https://tech-community.robotics.abb.com/t/array-problem/6934/5 "2016-10-11T01:08:03Z")

</div>

> [@guds](#):
>
> I try to convert some of our earlier programs from pcsdk.5.10 to pcsdk.6.02.01 but encounter a problem.
> 
> The code below is to set the value of a Num Array in the controller.
> 
> These codes work fine with pcsdk.5.10, however, it just don’t work when I replace the dll with pcsdk 6.02.01 under Windows 7 64-bit (.net4.5 VS2012).
> 
> **_No error or exception appear but the values in controller remain unchanged._**
> 
> I think these codes are very similar to those in the pcsdk example document.
> 
> Does anyone has an idea about what is going on?
> 
> Num rapidNum1;  
> Num rapidNum2;
> 
> RapidData rd = controller.Rapid.GetTask(“T\_ROB1”).GetModule("MainModule).GetRapidData("varArray1);  
> ArrayData ad = (ArrayData)rd.Value;
> 
> rapidNum1.Value = 123.45;
> 
> rapidNum2.Value = 678.90;
> 
> ad[0] =rapidNum1;
> 
> ad[1] =rapidNum2;
> 
> rd.Value= ad;

Hi,guds  
To read RAPID data you need to log on to the controller. To modify RAPID data you must also request mastership of the Rapid domain.  
You could look here [http://developercenter.robotstudio.com/Index.aspx?DevCenter=RobotCommunication&OpenDocument&Url=html/b1292029-6609-414f-8256-5af31073d5e5.htm](http://developercenter.robotstudio.com/Index.aspx?DevCenter=RobotCommunication&OpenDocument&Url=html/b1292029-6609-414f-8256-5af31073d5e5.htm)

---

<div class="post-metadata">

**Author:** ![baijun](https://avatars.discourse-cdn.com/v4/letter/b/e0b2c6/32.png) [@baijun](https://tech-community.robotics.abb.com/u/baijun)\
**Post date:** [October 11, 2016, 1:11am UTC](https://tech-community.robotics.abb.com/t/array-problem/6934/6 "2016-10-11T01:11:21Z")

</div>

> [@guds](#):
>
> I try to convert some of our earlier programs from pcsdk.5.10 to pcsdk.6.02.01 but encounter a problem.
> 
> The code below is to set the value of a Num Array in the controller.
> 
> These codes work fine with pcsdk.5.10, however, it just don’t work when I replace the dll with pcsdk 6.02.01 under Windows 7 64-bit (.net4.5 VS2012).
> 
> **_No error or exception appear but the values in controller remain unchanged._**
> 
> I think these codes are very similar to those in the pcsdk example document.
> 
> Does anyone has an idea about what is going on?
> 
> Num rapidNum1;  
> Num rapidNum2;
> 
> RapidData rd = controller.Rapid.GetTask(“T\_ROB1”).GetModule("MainModule).GetRapidData("varArray1);  
> ArrayData ad = (ArrayData)rd.Value;
> 
> rapidNum1.Value = 123.45;
> 
> rapidNum2.Value = 678.90;
> 
> ad[0] =rapidNum1;
> 
> ad[1] =rapidNum2;
> 
> rd.Value= ad;

Hi,guds  
To read RAPID data you need to log on to the controller. To modify RAPID data you must also request mastership of the Rapid domain.  
You could look here [http://developercenter.robotstudio.com/Index.aspx?DevCenter=RobotCommunication&OpenDocument&Url=html/b1292029-6609-414f-8256-5af31073d5e5.htm](http://developercenter.robotstudio.com/Index.aspx?DevCenter=RobotCommunication&OpenDocument&Url=html/b1292029-6609-414f-8256-5af31073d5e5.htm)
