Skip to main content

how do you create a datatable, i do not see the create datatable activity?

Comments

9 comments

  • Permanently deleted user

    Hi Jeff, you can create the variable in the variables section and then use an assign activity like "dataTable=new DataTable()".

    Hope it helps!

    -Alejandro

    0
  • Permanently deleted user

    So here is my workflow, but after i insert data i get an error when i try to convert to features and select.  Got any hints?

     

     

     

    <Activity mc:Ignorable="sap" x:Class="{x:Null}" sap:VirtualizedContainerService.HintSize="362,1019" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:eac="clr-namespace:ESRI.ArcGIS.Client;assembly=ESRI.ArcGIS.Client" xmlns:eacg="clr-namespace:ESRI.ArcGIS.Client.Geometry;assembly=ESRI.ArcGIS.Client" xmlns:eact="clr-namespace:ESRI.ArcGIS.Client.Tasks;assembly=ESRI.ArcGIS.Client" xmlns:esri="http://schemas.esri.com/arcgis/client/2009" xmlns:gce="clr-namespace:Geocortex.Core.Extensions;assembly=Geocortex.Core" xmlns:gfc="clr-namespace:Geocortex.Forms.Client;assembly=Geocortex.EssentialsWpfApi" xmlns:gfci="clr-namespace:Geocortex.Forms.Client.Items;assembly=Geocortex.EssentialsWpfApi" xmlns:gr="clr-namespace:Geocortex.Reporting;assembly=Geocortex.Reporting" xmlns:gwa="clr-namespace:Geocortex.Workflow.Activities;assembly=Geocortex.Workflow" xmlns:gwa1="clr-namespace:Geocortex.Workflow.Activities;assembly=Geocortex.Workflow.Activities" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:s="clr-namespace:System;assembly=System.Core" xmlns:s1="clr-namespace:System;assembly=System" xmlns:s2="clr-namespace:System;assembly=mscorlib" xmlns:s3="clr-namespace:System;assembly=System.ServiceModel" xmlns:sa="clr-namespace:System.Activities;assembly=System.Activities" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:sd="clr-namespace:System.Data;assembly=System.Data" xmlns:sl="clr-namespace:System.Linq;assembly=System.Core" xmlns:sxs="clr-namespace:System.Xml.Serialization;assembly=System.Xml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

     

      <Sequence DisplayName="Create Datatable" sap:VirtualizedContainerService.HintSize="322,979" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces">

     

        <Sequence.Variables>

     

          <Variable x:TypeArguments="sd:DataTable" Name="dataTable1" />

     

          <Variable x:TypeArguments="sd:DataColumn" Name="dataColumn1" />

     

          <Variable x:TypeArguments="sd:DataColumn" Name="dataColumn2" />

     

          <Variable x:TypeArguments="sd:DataColumn" Name="dataColumn3" />

     

          <Variable x:TypeArguments="sd:DataRow" Name="dataRow1" />

     

          <Variable x:TypeArguments="esri:FeatureSet" Name="featureSet1" />

     

        </Sequence.Variables>

     

        <sap:WorkflowViewStateService.ViewState>

     

          <scg:Dictionary x:TypeArguments="x:String, x:Object">

     

            <x:Boolean x:Key="IsExpanded">True</x:Boolean>

     

          </scg:Dictionary>

     

        </sap:WorkflowViewStateService.ViewState>

     

        <Assign sap:VirtualizedContainerService.HintSize="300,57">

     

          <Assign.To>

     

            <OutArgument x:TypeArguments="sd:DataTable">[dataTable1]</OutArgument>

     

          </Assign.To>

     

          <Assign.Value>

     

            <InArgument x:TypeArguments="sd:DataTable">[New DataTable("Legals")]</InArgument>

     

          </Assign.Value>

     

        </Assign>

     

        <Assign sap:VirtualizedContainerService.HintSize="300,57">

     

          <Assign.To>

     

            <OutArgument x:TypeArguments="sd:DataColumn">[dataColumn1]</OutArgument>

     

          </Assign.To>

     

          <Assign.Value>

     

            <InArgument x:TypeArguments="sd:DataColumn">[dataTable1.Columns.Add("Serial_Number", Type.GetType("System.String"))]</InArgument>

     

          </Assign.Value>

     

        </Assign>

     

        <Assign sap:VirtualizedContainerService.HintSize="300,57">

     

          <Assign.To>

     

            <OutArgument x:TypeArguments="sd:DataColumn">[dataColumn2]</OutArgument>

     

          </Assign.To>

     

          <Assign.Value>

     

            <InArgument x:TypeArguments="sd:DataColumn">[dataTable1.Columns.Add("FRSTDIVID", Type.GetType("System.String"))]</InArgument>

     

          </Assign.Value>

     

        </Assign>

     

        <Assign sap:VirtualizedContainerService.HintSize="300,57">

     

          <Assign.To>

     

            <OutArgument x:TypeArguments="sd:DataColumn">[dataColumn3]</OutArgument>

     

          </Assign.To>

     

          <Assign.Value>

     

            <InArgument x:TypeArguments="sd:DataColumn">[dataTable1.Columns.Add("Survey_Type_Txt", Type.GetType("System.String"))]</InArgument>

     

          </Assign.Value>

     

        </Assign>

     

        <Assign sap:VirtualizedContainerService.HintSize="300,57">

     

          <Assign.To>

     

            <OutArgument x:TypeArguments="sd:DataColumn">[dataColumn3]</OutArgument>

     

          </Assign.To>

     

          <Assign.Value>

     

            <InArgument x:TypeArguments="sd:DataColumn">[dataTable1.Columns.Add("Aliquot_Part", Type.GetType("System.String"))]</InArgument>

     

          </Assign.Value>

     

        </Assign>

     

        <Assign sap:VirtualizedContainerService.HintSize="300,57">

     

          <Assign.To>

     

            <OutArgument x:TypeArguments="sd:DataRow">[dataRow1]</OutArgument>

     

          </Assign.To>

     

          <Assign.Value>

     

            <InArgument x:TypeArguments="sd:DataRow">[dataTable1.newrow()]</InArgument>

     

          </Assign.Value>

     

        </Assign>

     

        <gwa1:DataTableToFeatureSet DataTable="[dataTable1]" FeatureSet="[featureSet1]" sap:VirtualizedContainerService.HintSize="300,82" />

     

        <gwa1:SelectFeatures FeatureSet="[featureSet1]" sap:VirtualizedContainerService.HintSize="300,151" />

     

      </Sequence>

     

    </Activity>
    0
  • Permanently deleted user

    Hi Jeff

    without loading your workflow, have you named your DataTable?

          <Assign sap:VirtualizedContainerService.HintSize="242,59">

     

            <Assign.To>

     

              <OutArgument x:TypeArguments="x:String">[dt.Tablename]</OutArgument>

     

            </Assign.To>

     

            <Assign.Value>

     

              <InArgument x:TypeArguments="x:String">titlePlans</InArgument>

     

            </Assign.Value>

     

          </Assign>

    It may well make a difference  ;-)

    Regards

    Ralph

     

    0
  • Permanently deleted user

    This is what i am trying to do this:

    Read tab delimited file from disc into a datatable

    here is some .net code i was trying to follow:

    Dim table As DataTable = new DataTable("ParentTable")

        ' Declare variables for DataColumn and DataRow objects.

     

        Dim column As DataColumn

     

        Dim row As DataRow

        ' Create new DataColumn, set DataType, ColumnName 

     

        ' and add to DataTable.   

     

        column = New DataColumn()

     

        column.DataType = System.Type.GetType("System.Int32")

     

        column.ColumnName = "id"

     

        column.ReadOnly = True

     

        column.Unique = True

        ' Add the Column to the DataColumnCollection.

     

        table.Columns.Add(column)

        ' Create second column.

     

        column = New DataColumn()

     

        column.DataType = System.Type.GetType("System.String")

     

        column.ColumnName = "ParentItem"

     

        column.AutoIncrement = False

     

        column.Caption = "ParentItem"

     

        column.ReadOnly = False

     

        column.Unique = False

        ' Add the column to the table.

     

        table.Columns.Add(column)

    i can build most of this with the assign activity but when i try to do something with the table i get thiError:

    Aborted exception: 'The use of type 'System.Data.PropertyCollection' as a get-only collection is not supported with NetDataContractSerializer.  Consider marking the type with the CollectionDataContractAttribute attribute or the SerializableAttribute attribute or adding a setter to the property.'.

     

      The use of type 'System.Data.PropertyCollection' as a get-only collection is not supported with NetDataContractSerializer.  Consider marking the type with the CollectionDataContractAttribute attribute or the SerializableAttribute attribute or adding a setter to the property.

     

    External Activity: 3938 bytes received by clients error

     

    I need a sample of the correct way to build a datatable, add columns and rows to it.

    Jeff

     

     

    0
  • Permanently deleted user

    Hi Jeff,

    The error you are getting is a serialization error. The dataTable variable cannot be serialized, so when you use a client-side activity like “Select Features” it can’t be present. You need to add a new sequence in your workflow and put all the dataTable creation there, and then make the scope of the datatable to that sequence only (you can set the scope of a variable in the "variables" section on the bottom of workflow designer). Then, outside that sequence, you can place your client-side activity (like the select features in this case), and you can set the featureSet1 variable scope to the “main” sequence, so it’s available to the client.

    Hope it helps!

    -Alejandro

    0
  • Permanently deleted user

    yes that works.  i have one more question, do I add inside the build sequence or outside the sequence to the cloned table?

     

    0
  • Permanently deleted user

    here is an example of a vb.net statement that adds an array to a table:

     

    table.Rows.Add(57, "Koko", "Shar Pei", DateTime.Now())

     

    so how would you do this in workflow?

     

     
    0
  • Permanently deleted user

    Hi Jeff, You have to do it inside the the sequence, since you need to be able to access the DataTable and it's not available outside the sequence.

    Regards

    - Alejandro

    0
  • Permanently deleted user

    Hi Jeff,

    For adding columns and rows to a table there are a couple of different ways; the "old" way would be to use an InvokeMethod to add each column and an InvokeMethod to add each row:

    For the column the TargetObject is the table's column collection; the method is Add; and the two parameters are a string for column name and Type for column data type.

        <InvokeMethod sap:VirtualizedContainerService.HintSize="218,128" MethodName="Add">

     

          <InvokeMethod.TargetObject>

     

            <InArgument x:TypeArguments="sd:DataColumnCollection">[dataTable.Columns]</InArgument>

     

          </InvokeMethod.TargetObject>

     

          <InArgument x:TypeArguments="x:String">columnName</InArgument>

     

          <InArgument x:TypeArguments="s2:Type">[GetType(string)]</InArgument>

     

        </InvokeMethod>

    For the row the TargetObject is the table's row collection; the method is Add; the parameter is an array of objects.

        <InvokeMethod sap:VirtualizedContainerService.HintSize="218,128" MethodName="Add">

     

          <InvokeMethod.TargetObject>

     

            <InArgument x:TypeArguments="sd:DataRowCollection">[dataTable.Rows]</InArgument>

     

          </InvokeMethod.TargetObject>

     

          <InArgument x:TypeArguments="s2:Object[]">[{"foo"}]</InArgument>

     

        </InvokeMethod>

    The "new" way is to use either the C# Script or VB Script activities and then you can just use code directly e.g. dataTable.Columns.Add("columnName", typeof(string));

    0

Please sign in to leave a comment.