Add 8 string variables, 2 data tables to a single queue item

I wanted to add 8 string variables, 2 data table variables in a single queue item.
Community please help/suggest.

Hi @mohit_RPA

Do you want to add if all in one queue?

For adding data from datatable, you can use add bulk queue items activity.

For adding single variables, you can use add queue item activity.

Thanks for the response @sonaliaggarwal47
The requirement here is to add 8 string variables and 2 data tables into 1 single transaction item/ Queue item

Hi @mohit_RPA

In that case you will need to run the loop on datatable and add items from a row individually along with other string variables and then in next iteration, other data rows gets added

1 Like

you can concatinate your strings with some delimiter # or @ then you can convert your data tables to json and add those as well concatinating with other strings,
so to conclude →
string1+string2+…+String (json of datatable1)+String (json of datatable2)

1 Like

@mohit_RPA

you can convert the datatable tos tring using output datatable and add to queue

few things to bear in mind

  1. When you change to string or serialize when you retrieve you need to deserialize
  2. Also there is a limitation for queue item size and if datatable is big it might error out

cheers

1 Like

Hi @mohit_RPA

You can definitely add multiple variables (strings & datatables) into one queue item, but you cannot store a DataTable directly in Orchestrator Queue Item because Queue Type is not allowed. But you must serialise it and store it. But when you can read back you need to deserialise and use it.

You can serilaise like :
dtJson = Newtonsoft.Json.JsonConvert.SerializeObject(YourDataTable)

you can deserialise like
dt1 = Newtonsoft.Json.JsonConvert.DeserializeObject(Of DataTable)(queueItem.SpecificContent(ā€œdtJsonā€).ToString)

1 Like

Thank you community for the help, I am able to push the DataTable to a queue item by converting it into a JSON string. However, when I try to convert the JSON string back into a DataTable, I encounter an error that seems related to a blank row in the header, specifically for ā€˜User Mobile Number’.

To provide some context, I am sharing a sample input data. The business requirement is that each row may have a value under either the ā€˜User Mobile Number’ column or the ā€˜User Phone Number’ column. Both columns might contain values, or only one of them will have a non-blank value. Please suggest how to handle this scenario when deserializing the JSON string back into a DataTable.
image

Hi @mohit_RPA

This happens because DataTable columns auto-infer data types, and your ā€œUser Mobile Numberā€ column contains: Eg : ā€œ1111234566ā€ which is double.

It always good we convert all phone/mobile number columns to String before we serialize.

Use an Assign before serialization in for each loop in datatable

If col.ColumnName = ā€œUser Mobile Numberā€ OrElse col.ColumnName = ā€œUser Phone Numberā€ Then
Assign → col.DataType = GetType(String)

Hope this will solve your issue.

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