Jump to content

Retrieving info from table using 'Read Row from DTI'


Recommended Posts


I'm having some issues retrieving info from a specific row in a table, is there an easy way to do this?
I've tried using "Read Row from DTI", but it asks me to use a struct as an output with the same row structure, but I want this rows output to go into a single variable.



Link to comment
Share on other sites

Hello Exouxas,


Thank you for using our Unitronics Forum.


In order to pull a row from a data table, you must put it in an "instance" of the struct the data table was formed from.  (An instance is a variable with the "Type" being the struct)  Once this data is pulled, you can drill into this variable of the struct to pull single variables.  This architecture was created to organize and ensure proper data transfer.


So, lets say I have a program for recipes, and I have a data table with two columns based off my struct:  column 1 = recipe name, column 2 = motor speed (for mixer).  To get the motor speed, I use a read data table row, put that info into an instance I call "Run Recipe", and to get the motor speed, I would click within a box that supports and integer, choose "Run Recipe" then choose "Motor Speed".  It will appear as "Run Recipe.Motor Speed" in the integer box.


Please let us know if this helps.

Link to comment
Share on other sites

OK, you will still need to create an instance to extract the data to.  Within the global tags list, click the add new tag button, and give this tag the name of "Data Table Row Info" or something of that sort.  Then, under the "Type" scroll down to the bottom selections and you should see you struct you created for the data table.  Select this struct and save the tag.


In your read row from data table function block, you should now be able to select the instance you created.  Wherever you wish to put that information, you will have to call it as "Data Table Row Info.*****". 


It was created like this to ensure the data table row extracted matched the data types it was being entered into.  Unfortunately, we are unable to extract a data table cell from the data table at this time (even though you only have one column to search from).  We can only extract rows via the row number.


A good video to watch, which can probably explain this feature better than I over the forum, is the tutorial on Data Table Indexed on our youtube page.  You can find the link to this page on our web page www.unitronics.com/support/webinars under the title "UniStream Tutorial Webinars".


Let us know if this helps.

Link to comment
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.

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.

  • Create New...