Append Collection Field Type to an existing collection
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
09-07-18 10:55 PM
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:
If Not Collection.Columns.Contains(Column) Then
Collection.Columns.Add(Column, typeof(DataTable))
End If
For Each dr As System.Data.DataRow In Collection.Rows
dr(Column) = Value
Next
New_Collection = Collection
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.
Any ideas would be greatly appreciated.
Andrzej Silarow
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
10-07-18 06:20 AM
Try System.Type.GetType(""System.Data.DataTable"") instead of typeof(DataTable)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
11-07-18 12:34 AM
Cheers John,
That didn't work (it was returning a null value), but it gave me a lead on how to solve it:
Dim a As Type
Dim b As DataTable
b = New DataTable
a = b.GetType()
If Not Collection.Columns.Contains(Column) Then
Collection.Columns.Add(Column, a)
End If
New_Collection = Collection
:-)
Regards,
Andrzej.
Andrzej Silarow
