Jump to content

read string column from data table


Recommended Posts

Hi, I'm sorry if such topic has already  been covered but somehow I couldn't find it. So I need to read string column from data table into something like list of text, but according to help files that states:

Quote

Not all Data Types are supported:

  • Unsupported types: Boolean, Byte, String, all 'Address of' types.

  • Supported Data Types: Integer (16-bit), Long, Float, Timer (32 bit)

 I'm not sure if this is possible. If yes, could I ask for a link to this topic?

Regards,

Martin

Link to comment
Share on other sites

  • MVP 2023
4 hours ago, krolikbest said:

I need to read string column from data table into something like list of text

Normally, string data is stored in a vector of MIs, 2 characters per MI. You can easily read string data from a Data Table to an MI vector, but I don't think it's possible to directly transfer that data to a List of Texts HMI element. If there is some roundabout way to do this I'd love to know it.

Link to comment
Share on other sites

5 hours ago, Flex727 said:

Normally, string data is stored in a vector of MIs, 2 characters per MI. You can easily read string data from a Data Table to an MI vector, but I don't think it's possible to directly transfer that data to a List of Texts HMI element. If there is some roundabout way to do this I'd love to know it.

Yes, you can. there is a workaround for that that I found using the string library:

 

  1. you store the strings on a data table
  2. load strings in the Data table to the desired MI using the data table read function.
  3. Set up String Library (String Storage 1 row 5 or whatever ) with variables pointing to the MIs where the string is stored.
  4. From the List of Text HMI element selects the string from String Library.
  5. That's all.

Although depending on the application using String Storage instead of the Data table may be a better solution, I used the above because I set it up a list of descriptions and names that needs to be able to be updated, so it can not be a hard coded string.

  • Upvote 2
Link to comment
Share on other sites

  • MVP 2023
9 minutes ago, Fernando Castro said:

Yes, you can. there is a workaround for that that I found using the string library:

 

  1. you store the strings on a data table
  2. load strings in the Data table to the desired MI using the data table read function.
  3. Set up String Library (String Storage 1 row 5 or whatever ) with variables pointing to the MIs where the string is stored.
  4. From the List of Text HMI element selects the string from String Library.
  5. That's all.

Although depending on the application using String Storage instead of the Data table may be a better solution, I used the above because I set it up a list of descriptions and names that needs to be able to be updated, so it can not be a hard coded string.

Nice!

Link to comment
Share on other sites

  • 2 weeks later...
  • MVP 2023
On 9/26/2022 at 1:40 PM, Fernando Castro said:

Yes, you can. there is a workaround for that that I found using the string library:

 

  1. you store the strings on a data table
  2. load strings in the Data table to the desired MI using the data table read function.
  3. Set up String Library (String Storage 1 row 5 or whatever ) with variables pointing to the MIs where the string is stored.
  4. From the List of Text HMI element selects the string from String Library.
  5. That's all.

@Fernando Castro, thank you for this. I suddenly had a pressing need for this strategy on my current project and it worked perfectly.

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.

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.

×
×
  • Create New...