A datatable of Messages

Is it possible to create a datatable of Messages type?

I am extracting the message threads from a slack channel using slack activities Get Messages and Get Rerplies. I need to collect some data from each message’s replies before sorting the message threads for the next step of the process.

Is it possible to create a datatable of Message types to store all my collected Messages and corresponding replies? The process is returning an error “Build Data Table: Column requires a valid DataType.” for the Build Data table activity, which is initially being declared as “Message” type (UiPath.Slack.Model.Message).

Irrelevant to the issue above, but I am using the messages’ reply count to add datacolumns to the datatable depending on the highest reply count. That way I can populate it with all message threads.

DataTables have a restricction about the datatype of its collumns.

You can read more about it in this link DataColumn.DataType Property (System.Data) | Microsoft Learn

I suggest you to try to use other DataType, maybe get from UiPath.Slack.Model.Message object only what you need like the text and save it as a String collumn in the datatable. Or use other kind of data structure to do what you want.

I was able to create a column with a datatype of System.Object - and you should be able to store anything in there. You’ll just have to know that it’s object instead of UiPath.Slack.Model.Message and handle that appropriately in your expressions.

1 Like

If your datatable would only have one column, you don’t need to use a datatable. You could use a List(of UiPath.Slack.Model.Message)

@Alvin_Hili

Ideally a list is a better choice for your case rather than a datatable

Cheers

Thanks, yes this was plan b. I only really need the .text and .ts (timestamp) elements of the message type variable, so I’ll either creat a datatable for each or collect each messages’/reply’s taxt and ts and store them in a single string formatted DT.

Thanks, I’ll test this solution as well.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.