Get data from dataset directly to tag in UDT

Hello everybody,
I am trying to extract the data in an orderly way. I am getting an MQTT variable (Topic) containing information and I am breaking it down into chunks(Deconstruccion). I already have the dataset with the fragments and now I would like to take out the first fragment. I have seen in the manual that they use a table and things like that but I don’t see the way to do it direcly with a script. Can you help me?

Hi @OscarLucas, have you seen the following: Datasets - Ignition User Manual 8.1 - Ignition Documentation

You should just be able to read the value of the tag and then iterate/get the desired item in the dataset :slight_smile:

I have tried this way but it always gives error. The point is that I have an array as a return from the split command. I have no name table and headers.

I have done something for you to see what I have tried with his example.

Ah right, would you like to pull the individual items into other tags? You can use the lookup expression function to do this: lookup - Ignition User Manual 8.1 - Ignition Documentation

I thought you were trying to pull it into a view for display, sorry :sweat_smile:

Also as a side note, the original dataset information I linked was for scripting in python. You are using the expression language which is why it is giving you a configuration error.

It seems that this function can do it. But I can’t fix it. Any advice?

I apologise, I have just realised you don’t have anything to search on (don’t use lookup)!

Right the correct way to access a dataset if you know what column/row you need is to use:

{[.]New tag 1}[row, col]

Information on this can be found: Expression Language and Syntax - Ignition User Manual 8.1 - Ignition Documentation

If you wanted the first row in the first column, you would use: {[.]New tag 1}[0, 0]

Or you could use: {[.]New tag 1}[0, "parts"]

Sorry again, I’m not on form today (if I ever am :laughing:)

It was easier than expected.

Yep, got there in the end. Sorry again for taking you the long route :sweat_smile: