<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Append Collection Field Type to an existing collection in Product Forum</title>
    <link>https://community.blueprism.com/t5/Product-Forum/Append-Collection-Field-Type-to-an-existing-collection/m-p/85438#M36431</link>
    <description>Hi All,

I am trying to build a code stage to add a field type of "Collection" to an existing collection... but I can't find the relevant datatype to select.

The below code is not being accepted by the BP Compiler:


&amp;nbsp;If Not Collection.Columns.Contains(Column) Then
&amp;nbsp;Collection.Columns.Add(Column, typeof(DataTable))
&amp;nbsp;End If

For Each dr As System.Data.DataRow In Collection.Rows
&amp;nbsp;dr(Column) = Value
Next

New_Collection = Collection

&amp;nbsp;

Getting these error messages:

Compiler error at line 3: 'Is' expected.

Compiler error at line 3: 'DataTable' is a type and cannot be used as an expression.
&amp;nbsp;

Any ideas would be greatly appreciated.

&amp;nbsp;</description>
    <pubDate>Mon, 09 Jul 2018 21:55:00 GMT</pubDate>
    <dc:creator>asilarow</dc:creator>
    <dc:date>2018-07-09T21:55:00Z</dc:date>
    <item>
      <title>Append Collection Field Type to an existing collection</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Append-Collection-Field-Type-to-an-existing-collection/m-p/85438#M36431</link>
      <description>Hi All,

I am trying to build a code stage to add a field type of "Collection" to an existing collection... but I can't find the relevant datatype to select.

The below code is not being accepted by the BP Compiler:


&amp;nbsp;If Not Collection.Columns.Contains(Column) Then
&amp;nbsp;Collection.Columns.Add(Column, typeof(DataTable))
&amp;nbsp;End If

For Each dr As System.Data.DataRow In Collection.Rows
&amp;nbsp;dr(Column) = Value
Next

New_Collection = Collection

&amp;nbsp;

Getting these error messages:

Compiler error at line 3: 'Is' expected.

Compiler error at line 3: 'DataTable' is a type and cannot be used as an expression.
&amp;nbsp;

Any ideas would be greatly appreciated.

&amp;nbsp;</description>
      <pubDate>Mon, 09 Jul 2018 21:55:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Append-Collection-Field-Type-to-an-existing-collection/m-p/85438#M36431</guid>
      <dc:creator>asilarow</dc:creator>
      <dc:date>2018-07-09T21:55:00Z</dc:date>
    </item>
    <item>
      <title>Try System.Type.GetType(…</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Append-Collection-Field-Type-to-an-existing-collection/m-p/85439#M36432</link>
      <description>Try System.Type.GetType(""System.Data.DataTable"") instead of typeof(DataTable)</description>
      <pubDate>Tue, 10 Jul 2018 05:20:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Append-Collection-Field-Type-to-an-existing-collection/m-p/85439#M36432</guid>
      <dc:creator>John__Carter</dc:creator>
      <dc:date>2018-07-10T05:20:00Z</dc:date>
    </item>
    <item>
      <title>Cheers John,
That didn't…</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Append-Collection-Field-Type-to-an-existing-collection/m-p/85440#M36433</link>
      <description>Cheers John,
That didn't work (it was returning a null value), but it gave me a lead on how to solve it:
&amp;nbsp;Dim a As Type
&amp;nbsp;Dim b As DataTable
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b = New DataTable
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a = b.GetType()
If Not Collection.Columns.Contains(Column) Then
&amp;nbsp;Collection.Columns.Add(Column, a)
End If
New_Collection = Collection
&amp;nbsp;
:-)
Regards,
Andrzej.</description>
      <pubDate>Tue, 10 Jul 2018 23:34:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Append-Collection-Field-Type-to-an-existing-collection/m-p/85440#M36433</guid>
      <dc:creator>asilarow</dc:creator>
      <dc:date>2018-07-10T23:34:00Z</dc:date>
    </item>
  </channel>
</rss>

