<?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 How to use Field Mappings in Geoprocessing with C# and Geoprocessing.MakeValueArray in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-use-field-mappings-in-geoprocessing-with-c/m-p/1085304#M6968</link>
    <description>&lt;P&gt;A general question is how to define the Parameters when using FieldMapping arguments in Geoprocessing tools&lt;/P&gt;&lt;P&gt;For example the "FeatureClassToFeatureClass" allows (according to &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/conversion/feature-class-to-feature-class.htm" target="_blank"&gt;Feature Class To Feature Class (Conversion)—ArcGIS Pro | Documentation&lt;/A&gt;) the fields to be renamed, deleted, etc...&lt;/P&gt;&lt;P&gt;But there is no example avaialble for C#&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Aug 2021 13:33:43 GMT</pubDate>
    <dc:creator>ole1986</dc:creator>
    <dc:date>2021-08-03T13:33:43Z</dc:date>
    <item>
      <title>How to use Field Mappings in Geoprocessing with C# and Geoprocessing.MakeValueArray</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-use-field-mappings-in-geoprocessing-with-c/m-p/1085304#M6968</link>
      <description>&lt;P&gt;A general question is how to define the Parameters when using FieldMapping arguments in Geoprocessing tools&lt;/P&gt;&lt;P&gt;For example the "FeatureClassToFeatureClass" allows (according to &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/conversion/feature-class-to-feature-class.htm" target="_blank"&gt;Feature Class To Feature Class (Conversion)—ArcGIS Pro | Documentation&lt;/A&gt;) the fields to be renamed, deleted, etc...&lt;/P&gt;&lt;P&gt;But there is no example avaialble for C#&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 13:33:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-use-field-mappings-in-geoprocessing-with-c/m-p/1085304#M6968</guid>
      <dc:creator>ole1986</dc:creator>
      <dc:date>2021-08-03T13:33:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Field Mappings in Geoprocessing with C# and Geoprocessing.MakeValueArray</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-use-field-mappings-in-geoprocessing-with-c/m-p/1089768#M7043</link>
      <description>&lt;P&gt;This sample code worked for me:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;protected override async void OnClick()
	{
	  try
	  {
        var environment = Geoprocessing.MakeEnvironmentArray(overwriteoutput: true);

        var defaultGDB = Project.Current.DefaultGeodatabasePath;
        
        var srcLayer = "TestPoints";
        var srcGdb = @"C:\Data\FeatureTest\FeatureTest.gdb";

        var outputFeatureClass = @"TestTestPoints";

        var fields = new string[] { 
          @"TheDate ""TheDate"" true true false 8 Date 0 0,First,#,TestPoints,TheDate,-1,-1",
          @"CodePoint ""CodePoint"" true true false 4 Long 0 0,First,#,TestPoints,CodePoint,-1,-1",
          @"TheString ""TheString"" true true false 255 Text 0 0,First,#,TestPoints,TheString,0,255",
          @"TheInteger ""TheInteger"" true true false 4 Long 0 0,First,#,TestPoints,TheInteger,-1,-1",
          @"TheDouble ""TheDouble"" true true false 8 Double 0 0,First,#,TestPoints,TheDouble,-1,-1",
          @"NewString ""NewString"" true true false 255 Text 0 0,First,#,TestPoints,TheString,0,255'" };
        var fieldMap = string.Join (";", fields);

        var toolParameters = Geoprocessing.MakeValueArray(srcLayer, srcGdb, outputFeatureClass, null, fieldMap, null);

        GPExecuteToolFlags executeFlags = GPExecuteToolFlags.AddOutputsToMap | GPExecuteToolFlags.GPThread | GPExecuteToolFlags.AddToHistory | GPExecuteToolFlags.RefreshProjectItems;

        IGPResult gpResult = await Geoprocessing.ExecuteToolAsync("FeatureClassToFeatureClass", toolParameters, environment, null, null, executeFlags);

        Geoprocessing.ShowMessageBox(gpResult.Messages, "GP Messages", gpResult.IsFailed ? GPMessageBoxStyle.Error : GPMessageBoxStyle.Default);
      }
	  catch (Exception ex)
	  {
        MessageBox.Show($@"Error: {ex}");
	  }
	}&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 17 Aug 2021 20:57:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-use-field-mappings-in-geoprocessing-with-c/m-p/1089768#M7043</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2021-08-17T20:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Field Mappings in Geoprocessing with C# and Geoprocessing.MakeValueArray</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-use-field-mappings-in-geoprocessing-with-c/m-p/1090256#M7049</link>
      <description>&lt;P&gt;This example works for me too (so far).&lt;/P&gt;&lt;P&gt;So i am still in the expression that the Tool "Append" seem to have a bug using field mappings.&lt;BR /&gt;See my bug report&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-pro-sdk-questions/bug-in-geoprocessing-executetoolasync-quot-append/m-p/1084386" target="_blank"&gt;Bug in Geoprocessing.ExecuteToolAsync("Append") wh... - Esri Community&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Aug 2021 05:49:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-use-field-mappings-in-geoprocessing-with-c/m-p/1090256#M7049</guid>
      <dc:creator>ole1986</dc:creator>
      <dc:date>2021-08-19T05:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Field Mappings in Geoprocessing with C# and Geoprocessing.MakeValueArray</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-use-field-mappings-in-geoprocessing-with-c/m-p/1191643#M8393</link>
      <description>&lt;P&gt;Where is the sample code from? Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 17:55:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-use-field-mappings-in-geoprocessing-with-c/m-p/1191643#M8393</guid>
      <dc:creator>mcamp1</dc:creator>
      <dc:date>2022-07-12T17:55:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Field Mappings in Geoprocessing with C# and Geoprocessing.MakeValueArray</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-use-field-mappings-in-geoprocessing-with-c/m-p/1191678#M8398</link>
      <description>&lt;P&gt;I made up the sample that you see above to show that one can add different types of columns to a file geodatabase.&amp;nbsp; &amp;nbsp;If I remember correctly the bug had to do with adding columns to a shapefile.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 19:36:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-use-field-mappings-in-geoprocessing-with-c/m-p/1191678#M8398</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2022-07-12T19:36:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Field Mappings in Geoprocessing with C# and Geoprocessing.MakeValueArray</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-use-field-mappings-in-geoprocessing-with-c/m-p/1191701#M8400</link>
      <description>&lt;P&gt;Hi Wolf,&lt;/P&gt;&lt;P&gt;Thank you for the quick response. I am trying to create a field mapping to pass as a parameter to the ‘Table to Table’ geoprocessing tool, and your example code is the best resource I have found for defining the Field Mappings so far. I have a couple more questions if don’t mind.&lt;/P&gt;&lt;P&gt;Does the c# SDK have a field mapping object like python? If so, can you point me towards any documentation or code examples?&lt;/P&gt;&lt;P&gt;If not, is there any documentation for the string field mapping? This &lt;A href="https://gis.stackexchange.com/questions/251392/resources-for-arcpy-field-mappings-string-syntax" target="_self"&gt;link&lt;/A&gt; was the closest I could find.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 20:55:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-use-field-mappings-in-geoprocessing-with-c/m-p/1191701#M8400</guid>
      <dc:creator>mcamp1</dc:creator>
      <dc:date>2022-07-12T20:55:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Field Mappings in Geoprocessing with C# and Geoprocessing.MakeValueArray</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-use-field-mappings-in-geoprocessing-with-c/m-p/1192467#M8425</link>
      <description>&lt;P&gt;Unfortunately, the SDK does not have field mapping objects like python.&amp;nbsp; This and better Pro SDK for .Net suited documentation and sample usage code has been (and still is) on the Pro SDK team's wish list for a while.&amp;nbsp; If I remember correctly the example above (references in the 'bug' report) worked fine for geodatabases (file, etc.) but not for shapefiles.&amp;nbsp; &amp;nbsp;Are you trying read/write to a shapefile?&amp;nbsp; &amp;nbsp;I noticed that the 'bug' thread you mentioned above was never solved, I will reach out to Nobbir and find out where we left off.&amp;nbsp; &amp;nbsp;However, if you are just trying to copy / append data to a geodatabase the sample snippet should work.&amp;nbsp; &amp;nbsp;We also now have DDL support in the API:&amp;nbsp;&lt;A href="https://github.com/esri/arcgis-pro-sdk/wiki/ProConcepts-DDL" target="_blank"&gt;ProConcepts DDL · Esri/arcgis-pro-sdk Wiki (github.com)&lt;/A&gt;&amp;nbsp;which will allow you to inspect the schema of existing tables/feature classes.&amp;nbsp; However, DDL support is also limited to Geodatabases only.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know what you try to do.&amp;nbsp; You can also reach out to me at: &lt;A href="mailto:wkaiser@esri.com" target="_blank"&gt;wkaiser@esri.com&lt;/A&gt;&amp;nbsp;if you want to keep samples/data confidential.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 13:47:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-use-field-mappings-in-geoprocessing-with-c/m-p/1192467#M8425</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2022-07-15T13:47:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Field Mappings in Geoprocessing with C# and Geoprocessing.MakeValueArray</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-use-field-mappings-in-geoprocessing-with-c/m-p/1312419#M10097</link>
      <description>&lt;P&gt;I believe you can use field mapping to add a new field to the output table that does not exist in the input table. Is this correct?&lt;/P&gt;&lt;P&gt;In your example you have a field "NewString" the syntax is exactly like the previous entry for "TheString".&lt;/P&gt;&lt;P&gt;Would the syntax for a new string field be:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;@"NewString ""NewString"" true true false 255 Text 0 0"&lt;/LI-CODE&gt;&lt;P&gt;i.e. without the parameters from the input table.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2023 05:21:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-use-field-mappings-in-geoprocessing-with-c/m-p/1312419#M10097</guid>
      <dc:creator>StefanDieters1</dc:creator>
      <dc:date>2023-07-27T05:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Field Mappings in Geoprocessing with C# and Geoprocessing.MakeValueArray</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-use-field-mappings-in-geoprocessing-with-c/m-p/1312420#M10098</link>
      <description>&lt;P&gt;Is the setup for the&amp;nbsp; fieldmapping is the same for all geoprocessing that use a fieldmap e.g. Merge (Data Management) ?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2023 05:24:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-use-field-mappings-in-geoprocessing-with-c/m-p/1312420#M10098</guid>
      <dc:creator>StefanDieters1</dc:creator>
      <dc:date>2023-07-27T05:24:29Z</dc:date>
    </item>
  </channel>
</rss>

