How to add two different datatables in one common queue

Hello Everyone,

I have the following problem:

See the Image :

These are two different excels . The Column marked in green in left i already have it i the queue after reading it as a datatable. now in the same queue i have to insert the column marked in red on the right side from another excel. How can I do this ?

Thanks in advance

Same way you added the first one. Read Range into a datatable then Bulk Add Queue Items to add to a queue.

Hey @postwick , Could You please elaborate?

How did you add the first ones?

Not sure what I can elaborate on, there’s nothing to it. You use Read Range to read the data from Excel into a datatable. Then you use Bulk Add Queue Items to add the datatable rows to a queue.

Hi

I hope you would have either used ADD QUEUE ITEM activity or ADD TRANSACTION ITEM activity or BUIL ADD QUEUE ITEM activity for the green marked datatable

The same way we can do for that red marked datatable as well

Read that file and get the output as datatable

Now you can pass the read value one by one by passing the dt to GOR EACH ROW activity and inside the loop use a ADD QUEUE ITEM activity and mention the Same queue name and value as CurrentRow(“yourcolumnname”).ToString

That’s it

As simple as that

Cheers @Tarif_Mohammad

@Palaniyappan buit in this case i will have a separate queue item only with the data table marked in red. I want to have the red marked datatable just as in the same queue item as the green one

You mean you want to add both green and red marked datatable to the same queue

@Tarif_Mohammad

@Palaniyappan yes

Fine

Pls clarify how you added from green coloured datatable to that queue @Tarif_Mohammad

There is nothing stopping you from adding whatever you want to a queue - it’s wide open. I’ve explained more than once how to do this. You add the second set to the queue the same way you added the first set.

@Palaniyappan I read it as a datatable which i have named “var_FilteredFilialDirektionDT” and then used the following expression to upload it into the queue as a String:

String.join(",",var_FilteredFilialDirektionDT.asenumerable.select(function(row) row(item).tostring).toarray)

@postwick As i said i can add but it is creating a different queue Item which i dont want , i want to have them both in the same queue item

Five then
What activity you used to add that string to a queue item

Use one more of
The same activity with same expression to get that string and same queue name to upload

It will upload to that queue only and not to a new one

Cheers @Tarif_Mohammad

Then read both into separate datatables, then combine with Merge Datatable before converting to JSON (string) and adding to the queue. You can’t add datatables to a queue, queues don’t accept complex datatypes.

@Palaniyappan i am using Add Queue Item Activity and i already tried to do as u said, its uploading as a new queue item and not in the same queue item

You cannot add complex datatypes like datatable to a queue.

Why are you trying to combine all this into one queue item, anyway? That’s not normally how queue items are used.

But if you must do that, as I said, read both into separate datatables. Then Merge Datatable to combine them. Then convert to JSON (string) and add that as your value to the queue item.

@postwick will try this out, thanks for ur effort

1 Like

Thinking about it more, I probably wouldn’t merge the datatables.

I would convert them individually into JSON, and add each JSON string as a separate value within the queue item. You’d create a dictionary, and in that dictionary assign the first JSON string to something like myDict(“Names”) and the second datatable’s JSON string to something like myDict(“Numbers”). That way when you Get Transaction later, you have the two datatables (JSON strings) as separate values.

You could just convert them to CSV values or something like that if you don’t want to mess with JSON. Just anything that’s a string.