cancel
Showing results for 
Search instead for 
Did you mean: 

Insert New Column at required position in Collection

vinodchinthakin
Level 9
Hi @devneetmohanty07

I just found a code in C# on this Thread
which helps in Inserting a New Column before last column of collection. When I tried this code, the result am getting as Empty Output Collection.
As I can see by your previous threads, that you are an expert in VB.Net and collections , Could you modify this code to VB.net and make it to work as dynamic where I can Insert a Column at any required position.

DataTable Newdt = new DataTable("OutputDataTable");

for (int i=0; i<+ InputCollection.Columns.Count - 2; i++)
{
DataColumn col = new DataColumn(InputCollection.Columns.ToString(), typeof(System.String));
Newdt.Columns.Add(col);
}
DataColumn Newcol = new DataColumn(ColumnToAdd, typeof(System.String));
Newdt.Columns.Add(Newcol);
Newdt.Columns.Add(InputCollection.Columns[InputCollection.Columns.Count-1].ToString(), typeof(System.String));
OutputCollection=Newdt;

Thanks in advance.​​

------------------------------
vinod chinthakindi
------------------------------
13 REPLIES 13

Hi @ErjolaMema

You must to put the same Collection as output from the input.

​To summarise the code (C# language)

dt.Columns.Add("Col1", typeof(string)).SetOrdinal(0);
dtOut = dt;

Change 0 for your preferer position.


Hope this helps you.

See you in the community, bye 🙂

------------------------------
Pablo Sarabia
Architect
Altamira Assets Management
Madrid
------------------------------

Hi Pablo ,

Thanks for the reply ,but still isn't working



------------------------------
Erjola Mema
------------------------------

Hi Erjola,

Please try the following Digital Exchange asset, which is free and can perform the required task:

https://digitalexchange.blueprism.com/dx/entry/78038/solution/spgmi--utility-collection-booster

Hope it helps.

Thanks,
Amol Ashok Jangam.

------------------------------
amol jangam
test lead
infosys
Asia/Dili
------------------------------

oki 😄

On Fri, Apr 1, 2022 at 12:26 PM amol jangam via Blue Prism Community <Mail@blueprism.email> wrote:
Hi Erjola, Please try the following Digital Exchange asset, which is free and can perform the required task: digitalexchange.blueprism.com/dx... -posted to the "Blue Prism Product" community
29275.png

Blue Prism Product

Post New Message Online
Re: Insert New Column at required position in Collection
Reply to Group Online Reply to Group
amol jangam
Apr 1, 2022 11:24 AM
amol jangam
Hi Erjola,

Please try the following Digital Exchange asset, which is free and can perform the required task:

digitalexchange.blueprism.com/dx/entry/78038/solution/...

Hope it helps.

Thanks,
Amol Ashok Jangam.

------------------------------
amol jangam
test lead
infosys
Asia/Dili
------------------------------
  Reply to Group Online   Reply to Group via Email   View Thread   Recommend   Flag as Inappropriate