Dynamic variable as Array

Hi all

I defined a local dynamic variable “ySLF” from a structure typ as array[0..4] see declaration below.

And I did the sam without an array.

I tried to ACCESS a global variable with these dynamic variables.

The one without a array structure is working but the array dynamic variable is not.

image

I always get this error. Is it maybe not possible to declare a dynamic variable as array?

image

Hi there,

if you look at the variable declaration in textual format, you’ll see, why that is:

ySLF : REFERENCE TO ARRAY[0..4] OF SLF_T;

So it’s a reference to an array, not an array of references.

What you were expecting (and can’t do), would be:

ySLF : ARRAY[0..3] OF REFERENCE TO SLF_T;

Hope that makes sense :slight_smile:

1 Like

Yeah you are right…

Actually what I wanted to do is connecting different mappView Clients (using SlotId) to global variables in dependence of the actual pageId.

For that I would need this dynamic array variable and I could iterate with a for through all Clients, where de Index would be the SlotId of the Client.