Jump to content
Sign in to follow this  
CFBFP

Reading a row from a Data Table

Recommended Posts

Hi

 

i have made a datatable with 50 rows and 5 colums in Unilogic.

How can I read a row of this datatable and directly put them in my global variables?

(These global variables are used in my program to do more calculations with)

 

In Visilogic, this was very easy with the function "Read row from Datatables": you select the rownumber and had to fill in the source cells and direct them to the destination global variables.

 

I want to do the same in Unilogic.

 

Can someone help me?

 

thank you in advance.

Share this post


Link to post
Share on other sites

Hello,

 

In UniLogic, you must create an instance of the struct you used for the data table format.  This basically means you must create a tag with the "type" being the struct.  You can find the struct you used for the data table format near the bottom of the "type" list.

 

This tag you created will ensure the same data, in the same orientation as the columns are listed out, will be transferred correctly.  Also, it was designed to help to organize your data.

 

Once this is complete, you can use the read row function block for the according data table you used (LIFO, FIFO, Indexed) and pass that row data into your tag instance described above.  You can then call the individual tags by calling the data table, then the specific data.  (Example: Data_Table.Column1Data)

 

Please let us know if this helps.

Share this post


Link to post
Share on other sites

Hi,

 

if will try this first, but i'm not sure if i understand fully.

I still have to find out if the members of the new created struct can hold global variables or if they are only cells that i have to select with row, column to transfer them in the variable i want.

As i understand now there are 3 steps:

 

- making the datatable

- creating a new struct that meets the datatable to transfer values

- selecting the values with row/column and finally transfer them in my variable where if want it

 

 

thank you for your answer, i let you know if i succeeded.

Share this post


Link to post
Share on other sites

Hi,

 

if will try this first, but i'm not sure if i understand fully.

I still have to find out if the members of the new created struct can hold global variables or if they are only cells that i have to select with row, column to transfer them in the variable i want.

As i understand now there are 3 steps:

 

- making the datatable

- creating a new struct that meets the datatable to transfer values

- selecting the values with row/column and finally transfer them in my variable where if want it

 

 

thank you for your answer, i let you know if i succeeded.

Hello again,

 

I apologize if I gave you any confusion.  But your steps look to be correct to me.

 

Please allow me to clarify how the structs are working:

 

When a struct is created, you are basically creating a format.  No tags are associated with the structs created in the struct tab.  They are just for formatting, or you could look at the as a "configuration file".  This is why you must created an "instance" of the struct in the global tags list.

Let me know if this helps.

Share this post


Link to post
Share on other sites

Hi

 

this helped a lot. It is clear to me know and can use datatables fully as i wanted.

It is even more flexible as in Visilogic in my personal opinion.

 

many thanks!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...