Sign in to follow this  
Followers 0
pabspagg

Copying string from array of structures

4 posts in this topic

Hello!

I am trying to copy a part of a structure to an array. This is how my structure looks like:

data_typeee.PNG.7e01cb753294675c07d4fcde

The variable that contains the structure:arrayyy.PNG.e662f2c66fcd56255f70655e9121

I want to move only the first variable ("nome") to an array of strings. I tried move, arymove, memcopy, left,mid ,right, everything I could think of. But nothing worked.

I think the problem is the string was typed in the nb designer IHM and saved on the plc. But what NB designer does when u type a string? Is it converted?

I did a test and this is how it looks:

testeeee.PNG.79210146889294bd5f1ccddf758

 

The first part (Receitas[1].nome)  was typed  on the NB designer and the instruction move doesn´t work.

The second one I forced the value on plc and it worked. What am I missing here?

Thank you!

 

Edited by pabspagg

Share this post


Link to post
Share on other sites

I can't see where you are using the variable ARRAY_RECEITAS ? is that ladder screenshot in a function block?

It looks like you may have declared 2 variable arrays 1 called RECEITAS and another called ARRAY_RECEITAS

 

Share this post


Link to post
Share on other sites
1 hour ago, chelton said:

I can't see where you are using the variable ARRAY_RECEITAS ? is that ladder screenshot in a function block?

It looks like you may have declared 2 variable arrays 1 called RECEITAS and another called ARRAY_RECEITAS

 

Sorry. I have a function block which takes Receitas -> ARRAY_RECEITAS(Input from the fuction block). I should have printed outside the function block!

I think the problem it's about typing the string in the NB designer.  When I do and goes to plc (Receitas[X].nome), maybe it's not a string at all? Maybe array of words? Not sure though. 

If I force a string in the structure, I can copy easily. But if I get the string from the NB Designer I wasn't able copy it.

If I'm not clear , just tell me. I will try to explain a better way.

Edited by pabspagg

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0