cancel
Showing results for 
Search instead for 
Did you mean: 

Append Field type-collection

MateuszWojcik
Level 5
Hi, I want to create collection with subcollections inside one of my column. First I download collection from sharepoint, than I would like to add column using action like append field(text) but instead of text type I want my column to have collection type. Please let me know if you have any suggestion
6 REPLIES 6

BenKirimlidis
Level 7
Hi mwojcik2, This can be done with a simple calculation. I have attached an image with an example.  I have a collection called colCustomer which is already populated with some basic info as shown but there is a field which is called colAccount which is a collection datatype that is blank.  I have a second collection called colTempAccount which is pre populated with some info. A single calculation stage is all that is required to store colTempAccount into the collection variable colAccount inside colCustomer . Hope that helps! Kind regards, Ben

BenKirimlidis
Level 7
sory image didnt save first time

BenKirimlidis
Level 7
3rd times the charm.....?  tried jpeg this time

MateuszWojcik
Level 5
Hi Ben,   Thank you for your help. Unfortunately it is not what I am looking for.  Your idea assumes that collection "colCustomer" already has a defined column with collection type. My process download collection from SharePoint. In this collection there are column with text and number types.  When I have it downloaded I want to add extra column with collection type. I don't want to defined all column's type in process top avoid errors when there will be changes in SharePoint table.    I have solve this problem as follow. I have created additional collection with already defined 1 column with collection type. After I download SharePoint Collection I use merge action to add both collection.   I hope to find solution of adding additional column with collection type to main collection.   Kind regards Mateusz

AmiBarrett
Level 12
This was written in C#, but it should do what you're looking for. Some of the types are internally defined and I wasn't able to get a differentiation between them. (Text/Password, DateTime/Time)

Inputs:
Collection - Collection
colName - Text
colType - Text

Outputs:
New Collection - Collection

DataColumn col = new DataColumn();
if(colType=="Number"){ 
	col.DataType = System.Type.GetType("System.Int32");
} 
else if(colType=="Text" || colType=="Password"){
	col.DataType = System.Type.GetType("System.String");
}
else if(colType=="Collection"){ 
	col.DataType = typeof(DataTable);
} 
else if(colType=="Date" || colType=="DateTime" ||colType=="Time"){
	col.DataType = System.Type.GetType("System.DateTime");
} 
else if(colType=="Flag"){
	col.DataType = System.Type.GetType("System.Boolean");
} 
else if(colType=="TimeSpan"){
	col.DataType = System.Type.GetType("System.TimeSpan");
}
else if(colType=="Image"){
	col.DataType = typeof(Bitmap);
}
else if(colType=="Binary"){
	col.DataType = System.Type.GetType("System.Byte[]");
} 

col.ColumnName = colName; Collection.Columns.Add(col);Â Â  Â  New_Collection = Collection;

MateuszWojcik
Level 5
Thank you amibarrett. I have solve my problem in the following way. I create a collection "coll1" where 1 column "Shp_col" has defined type of collection. Coll1 is merge with collection obtained from SharePoint list "SHPcoll". Next I loop through SHPColl and add with calculation stage "coll3" to column "Shp_col". coll3 contains relevant data for specific row in SHPcoll.