<?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 Restrict some fields (and not all) to be visible in the layer pop up arcgis pro sdk in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/restrict-some-fields-and-not-all-to-be-visible-in/m-p/1365304#M10948</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am displaying a pop-up after a layer has been added to the active map. Two things need to be configured for the pop-up. One is to create an expression for the pop-up's display field. That is working correctly.&lt;/P&gt;&lt;P&gt;The second thing I want to implement is not to display all the fields of that layer (which is pop-up's default implementation), but to display some of those fields.&lt;/P&gt;&lt;P&gt;This is how I am creating an expression for the display field of the pop-up&amp;nbsp;&lt;/P&gt;&lt;P&gt;var cimFeatureDefinition = layer.GetDefinition() as CIMBasicFeatureLayer;&lt;BR /&gt;var cimDisplayTable = cimFeatureDefinition.FeatureTable;&lt;BR /&gt;cimDisplayTable.DisplayExpressionInfo = new CIMExpressionInfo&lt;BR /&gt;{&lt;BR /&gt;Expression = DisplayExpression,&lt;BR /&gt;Title = "Custom"&lt;BR /&gt;};&lt;BR /&gt;var baseLayer = cimFeatureDefinition as CIMBaseLayer;&lt;BR /&gt;layer.SetDefinition(baseLayer);&lt;/P&gt;&lt;P&gt;The above code is working correctly.&lt;/P&gt;&lt;P&gt;But the below code to display not all but some fields of the layer in pop-up is not working. Its actually also affecting the above code to work.&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;var fieldsList = new List&amp;lt;CIMPopupFieldDescription&amp;gt;();&lt;/DIV&gt;&lt;DIV&gt;foreach (var field in GetPopupFields())&lt;/DIV&gt;&lt;DIV&gt;{&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var popupFieldDescription = new CIMPopupFieldDescription&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Alias = field.AliasName,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FieldName = field.Name&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;};&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;fieldsList.Add(popupFieldDescription);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;var popupInfo = new CIMPopupInfo()&lt;/DIV&gt;&lt;DIV&gt;{&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FieldDescriptions = fieldsList.ToArray()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;};&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;var featureLayer = layer as FeatureLayer;&lt;/DIV&gt;&lt;DIV&gt;var cimFeatureDefinition = featureLayer.GetDefinition() as CIMBasicFeatureLayer;&lt;/DIV&gt;&lt;DIV&gt;cimFeatureDefinition.PopupInfo = popupInfo;&lt;/DIV&gt;&lt;DIV&gt;var baseLayer = cimFeatureDefinition as CIMBaseLayer;&lt;/DIV&gt;&lt;DIV&gt;featureLayer.SetDefinition(baseLayer);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Can someone help me to implement the correct way to display some of the fields in the pop-up?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/145101"&gt;@CharlesMacleod&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/12882"&gt;@Wolf&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/42133"&gt;@GKmieliauskas&lt;/a&gt;&amp;nbsp;&lt;/DIV&gt;</description>
    <pubDate>Tue, 02 Jan 2024 14:01:10 GMT</pubDate>
    <dc:creator>CarlosK</dc:creator>
    <dc:date>2024-01-02T14:01:10Z</dc:date>
    <item>
      <title>Restrict some fields (and not all) to be visible in the layer pop up arcgis pro sdk</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/restrict-some-fields-and-not-all-to-be-visible-in/m-p/1365304#M10948</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am displaying a pop-up after a layer has been added to the active map. Two things need to be configured for the pop-up. One is to create an expression for the pop-up's display field. That is working correctly.&lt;/P&gt;&lt;P&gt;The second thing I want to implement is not to display all the fields of that layer (which is pop-up's default implementation), but to display some of those fields.&lt;/P&gt;&lt;P&gt;This is how I am creating an expression for the display field of the pop-up&amp;nbsp;&lt;/P&gt;&lt;P&gt;var cimFeatureDefinition = layer.GetDefinition() as CIMBasicFeatureLayer;&lt;BR /&gt;var cimDisplayTable = cimFeatureDefinition.FeatureTable;&lt;BR /&gt;cimDisplayTable.DisplayExpressionInfo = new CIMExpressionInfo&lt;BR /&gt;{&lt;BR /&gt;Expression = DisplayExpression,&lt;BR /&gt;Title = "Custom"&lt;BR /&gt;};&lt;BR /&gt;var baseLayer = cimFeatureDefinition as CIMBaseLayer;&lt;BR /&gt;layer.SetDefinition(baseLayer);&lt;/P&gt;&lt;P&gt;The above code is working correctly.&lt;/P&gt;&lt;P&gt;But the below code to display not all but some fields of the layer in pop-up is not working. Its actually also affecting the above code to work.&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;var fieldsList = new List&amp;lt;CIMPopupFieldDescription&amp;gt;();&lt;/DIV&gt;&lt;DIV&gt;foreach (var field in GetPopupFields())&lt;/DIV&gt;&lt;DIV&gt;{&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var popupFieldDescription = new CIMPopupFieldDescription&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Alias = field.AliasName,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FieldName = field.Name&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;};&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;fieldsList.Add(popupFieldDescription);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;var popupInfo = new CIMPopupInfo()&lt;/DIV&gt;&lt;DIV&gt;{&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FieldDescriptions = fieldsList.ToArray()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;};&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;var featureLayer = layer as FeatureLayer;&lt;/DIV&gt;&lt;DIV&gt;var cimFeatureDefinition = featureLayer.GetDefinition() as CIMBasicFeatureLayer;&lt;/DIV&gt;&lt;DIV&gt;cimFeatureDefinition.PopupInfo = popupInfo;&lt;/DIV&gt;&lt;DIV&gt;var baseLayer = cimFeatureDefinition as CIMBaseLayer;&lt;/DIV&gt;&lt;DIV&gt;featureLayer.SetDefinition(baseLayer);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Can someone help me to implement the correct way to display some of the fields in the pop-up?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/145101"&gt;@CharlesMacleod&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/12882"&gt;@Wolf&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/42133"&gt;@GKmieliauskas&lt;/a&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Tue, 02 Jan 2024 14:01:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/restrict-some-fields-and-not-all-to-be-visible-in/m-p/1365304#M10948</guid>
      <dc:creator>CarlosK</dc:creator>
      <dc:date>2024-01-02T14:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict some fields (and not all) to be visible in the layer pop up arcgis pro sdk</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/restrict-some-fields-and-not-all-to-be-visible-in/m-p/1365342#M10949</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Try to add NumberFormat initialization to new created CIMPopupFielDescription:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var popupFieldDescription = new CIMPopupFieldDescription
{
    Alias = field.AliasName,
    FieldName = field.Name,
    NumberFormat = field.NumberFormat
};&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 02 Jan 2024 14:56:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/restrict-some-fields-and-not-all-to-be-visible-in/m-p/1365342#M10949</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2024-01-02T14:56:33Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict some fields (and not all) to be visible in the layer pop up arcgis pro sdk</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/restrict-some-fields-and-not-all-to-be-visible-in/m-p/1365427#M10952</link>
      <description>&lt;P&gt;What does the function GetPopupFields look like? Do you have any logic to determine which fields get added?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 16:47:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/restrict-some-fields-and-not-all-to-be-visible-in/m-p/1365427#M10952</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2024-01-02T16:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict some fields (and not all) to be visible in the layer pop up arcgis pro sdk</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/restrict-some-fields-and-not-all-to-be-visible-in/m-p/1365479#M10955</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/2839"&gt;@KenBuja&lt;/a&gt;&amp;nbsp;In getpopfields i am just returning a static list of fields that needs to be displayed in the popup having only actual and alias field names&lt;/P&gt;&lt;P&gt;So basically I will have list of fields that I want to make it visible and that is stored in a list. Now what is the way to configure popups with some of the fields to be visible in pop up. With the above code I am also getting memory issue when creating the pop up info.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;$exception {"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."} System.AccessViolationException&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2024 08:23:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/restrict-some-fields-and-not-all-to-be-visible-in/m-p/1365479#M10955</guid>
      <dc:creator>CarlosK</dc:creator>
      <dc:date>2024-01-03T08:23:59Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict some fields (and not all) to be visible in the layer pop up arcgis pro sdk</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/restrict-some-fields-and-not-all-to-be-visible-in/m-p/1365480#M10956</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/42133"&gt;@GKmieliauskas&lt;/a&gt;&amp;nbsp;what is numberformat? right i have only stated the list of fields with actual name and alias name. this getpopupfields data i am not getting from some layer but its just a static list i have created in which i have only defined actual and alias name. therefore i don’t have numberformat.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 18:18:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/restrict-some-fields-and-not-all-to-be-visible-in/m-p/1365480#M10956</guid>
      <dc:creator>CarlosK</dc:creator>
      <dc:date>2024-01-02T18:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict some fields (and not all) to be visible in the layer pop up arcgis pro sdk</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/restrict-some-fields-and-not-all-to-be-visible-in/m-p/1365513#M10957</link>
      <description>&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic36850.html" target="_self"&gt;NumberFormat&lt;/A&gt; is used in ArcGIS Pro SDK community &lt;A href="https://github.com/Esri/arcgis-pro-sdk-community-samples/blob/master/NetworkDiagram/ExportDiagramToFeatureClasses/ExportPaneViewModel.cs" target="_self"&gt;sample&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;    /// &amp;lt;summary&amp;gt;
    /// Change field name in popup fields
    /// &amp;lt;/summary&amp;gt;
    /// &amp;lt;param name="FieldDescriptions"&amp;gt;Source CIMPopupFieldDescription array&amp;lt;/param&amp;gt;
    /// &amp;lt;returns&amp;gt;New CIMPopupFieldDescription array&amp;lt;/returns&amp;gt;
    private CIMPopupFieldDescription[] ChangeFieldNameInPopupFields(CIMPopupFieldDescription[] FieldDescriptions)
    {
      if (FieldDescriptions == null)
        return null;

      List&amp;lt;CIMPopupFieldDescription&amp;gt; fieldsList = new();

      foreach (CIMPopupFieldDescription fieldDescription in FieldDescriptions)
      {
        CIMPopupFieldDescription newDescript = new()
        {
          Alias = fieldDescription.Alias,
          FieldName = GetNewFieldName(fieldDescription.FieldName),
          NumberFormat = fieldDescription.NumberFormat
        };

        fieldsList.Add(newDescript);
      }

      return fieldsList.ToArray();
    }&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 02 Jan 2024 19:06:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/restrict-some-fields-and-not-all-to-be-visible-in/m-p/1365513#M10957</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2024-01-02T19:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict some fields (and not all) to be visible in the layer pop up arcgis pro sdk</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/restrict-some-fields-and-not-all-to-be-visible-in/m-p/1365641#M10961</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/42133"&gt;@GKmieliauskas&lt;/a&gt;&amp;nbsp;Thats what I am saying I don't have number format. The field description list I have is being created by me manually and I am not taking that info from somewhere. therefore, i don't have numberformat info.in that list when i created i have added only actual name and alias name of the fields.&lt;/P&gt;&lt;P&gt;So basically I will have list of fields that I want to make it visible and that is stored in a list. Now what is the way to configure popups with some of the fields to be visible in pop up. With the above code I am also getting memory issue when creating the pop up info.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;$exception {"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."} System.AccessViolationException&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2024 08:23:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/restrict-some-fields-and-not-all-to-be-visible-in/m-p/1365641#M10961</guid>
      <dc:creator>CarlosK</dc:creator>
      <dc:date>2024-01-03T08:23:03Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict some fields (and not all) to be visible in the layer pop up arcgis pro sdk</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/restrict-some-fields-and-not-all-to-be-visible-in/m-p/1365724#M10963</link>
      <description>&lt;P&gt;I would try to take original popup fields like in my copy/pasted sample above and then leave only fields are required. Add to sample code additional parameter with list of field names and inside foreach check if&amp;nbsp;fieldDescription field name exists in your list.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;    private CIMPopupFieldDescription[] ChangeFieldNameInPopupFields(CIMPopupFieldDescription[] FieldDescriptions, List&amp;lt;string&amp;gt; fieldNames)
    {
      if (FieldDescriptions == null)
        return null;

      List&amp;lt;CIMPopupFieldDescription&amp;gt; fieldsList = new();

      foreach (CIMPopupFieldDescription fieldDescription in FieldDescriptions)
      {
        if(!fieldNames.Contains(fieldDescription.FieldName) continue;

        CIMPopupFieldDescription newDescript = new()
        {
          Alias = fieldDescription.Alias,
          FieldName = fieldDescription.FieldName,
          NumberFormat = fieldDescription.NumberFormat
        };

        fieldsList.Add(newDescript);
      }

      return fieldsList.ToArray();
    }&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 03 Jan 2024 13:03:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/restrict-some-fields-and-not-all-to-be-visible-in/m-p/1365724#M10963</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2024-01-03T13:03:21Z</dc:date>
    </item>
  </channel>
</rss>

