Exouxas Posted October 31, 2014 Report Share Posted October 31, 2014 G'day! 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. Thanks, Exouxas Quote Link to comment Share on other sites More sharing options...
s.pratt Posted October 31, 2014 Report Share Posted October 31, 2014 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. Quote Link to comment Share on other sites More sharing options...
Exouxas Posted October 31, 2014 Author Report Share Posted October 31, 2014 Nope, I'm still lost. What I have is a two-way "encoding" that turns decimals to hex"ish" (0-J instead of 0-F) and puts it in a string. And the other way. I have a table with one column that contains the Hex"ish" and I plan to use the row number as the decimals. Quote Link to comment Share on other sites More sharing options...
s.pratt Posted October 31, 2014 Report Share Posted October 31, 2014 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.