Gather DataTable from work Queue

Hey Team,
I have a bunch of datatables (with nested datatables within them) stored in my queue which have been extracted from the Process Application
How do I get the datatables…

  1. into the queue as it looks as though queue items can only be strings?
  2. Out of the queue as I can only seem to pull out a ‘QueueItem’ variable at the moment

Thanks

Hi @elliot.barling ,

We should be able to serialize the datatable and add to the Queue Item and then when retrieving deserialize back to the Datatable.

This is in case where the queue item is needed as the Datatable value itself.

Serializing the datatable :

strJsonDT = Newtonsoft.Json.JsonConvert.SerializeObject(YourDT)

Deserializing the datatable :

DT = Newtonsoft.Json.JsonConvert.DeserializeObject(Of Datatable)(QueueItemSpecificContent)

QueueItemSpecificContent is expected to be a string Value that you would receive from the Queue Item.

Thanks for that.
When deserialising the DataTable, where do I reference the queue item variable which I pull out using the Get Transaction Item activity.

Also, is the ‘queueitemspecificcontent’ a string variable which needs to be created? (I am assuming so but wanted to double check)

Thanks

@elliot.barling ,

Considering the output of Get Transaction Item activity, let is be named as TransactionItem.

Then we can extract the value from it like below :

QueueItemSpecificContent = TransactionItem.SpecificContent("DT_Json").ToString

Here, DT_Json is also the name of the argument that we use when we pass the serialized value in Add Queue Item activity.

We could then use the expression in my previous post to convert back to datatable.

Ah okay, I think I know why I am getting confused now!
So I have the ‘Load Queue’ part as a separate process so that the process queue can be run alongside or on multiple bots if necessary.
Therefore, I don’t have the ‘Add Queue Item’ within the same process as the ‘Get Transaction Item’ and so do not have the relevant arguments and variables.
Does this create an issue?

@elliot.barling ,

The two activities need not be in the same process.

@supermanPunch

I have the following set up:
LOAD QUEUE:

Assigning the DataTable to a String JSON variable:

image

Adding the string variable to the queue:

GET QUEUE ITEM

Getting the string variable out of the queue as a queue item variable

image

Assigning the queue item variable back to a string

image

I received an error on the last activity - ‘The given key was not present in the dictionary’

@elliot.barling ,

You have given the key as strJSONDT but it should be QueueItem as you have passed this name as argument name in item collection

Still appear to be getting the same issue I’m afraid
image

image

@elliot.barling ,

In that case, could you perform a Debug and check the content of out_TransactionItem.SpecificContent in immediate panel, which should be able to let us understand what are the contents present in it.

Also, do check if you are using the same Queue name.

@supermanPunch

This is the value of out_TransactionItem:

QueueItem { AssignedTo=null, DeferDate=null, DueDate=null, Id=590148504, ItemKey=[8a8834c1-be47-4012-9c08-2d5365f4cf6e], LastProcessingOn=null, Output=null, Priority=Normal, ProcessingException=null, Progress=“”, QueueDefinitionId=154807, QueueName=“FIG_EndOfDay”, Reference=“Exec Trades/PTT Instru”, RetryNo=0, ReviewStatus=“None”, RowVersion=byte[8] { 0, 0, 0, 0, 103, 235, 105, 156 }, SpecificContent=Dictionary<string, object>(0) { }, StartTransactionTime=[07/11/2023 12:15:16], Status=InProgress }

SpecificContentm Value

image

@elliot.barling ,

From this Debugging, we understand that there are no values passed as Item information when adding the Queue Item details.

Also, we have the Queue Name mentioned, cross check if the same Queue has been used, also check in the Orchestrator for the Queue if there are any items and values available.

We need to check it after the Add Queue Item activity is executed whether the queue item is actually getting added to the Queue in Orchestrator.

All sorted, it turns out it was trying to load an old queue item before I made some of the adjustments above! The new logic is working :slight_smile:

As a side question… the Datatable I have loaded has a nested table within it, is there a simple way to extract this nested datatable? :sweat_smile:

Thanks for all of your help

@elliot.barling ,

We need to understand more on this context. If this is diverting from the Original Topic, would request you to create a Separate post, so we have a dedicated post for it and we can narrow our conclusions for that specific problem.

We would need more understanding of the Nested Datatable created.

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