<?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 Re: How to concatenate fields to show Graph... in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/how-to-concatenate-fields-to-show-graph/m-p/1157593#M6044</link>
    <description>&lt;P&gt;Data Expressions can be a lot to wrap your head around, but it's totally the way to go. This will allow you to create a "virtual" field in your data that a chart can interact with.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var fs = FeatureSetByPortalItem(
    Portal('your-portal-url'),
    'itemid of feature service',
    0, // or whatever the layer index
    ['*'],
    false
)

// Get existing fields
var fields = Schema(fs)['fields']

// Push new feature into field array
Push(
    fields,
    {name: 'concat_vals', type: 'esriFieldTypeString'}
)

// Create dictionary to hold output features
var out_dict = {
    fields: fields,
    geometryType: '',
    features: []
}

// Iterate over features, concatenating fields and pushing into feature array
for (var f in fs){
    
    // Get feature as dict
    var feat = Dictionary(Text(f))
    
    // // Values to concatenate
    var concat_arr = [
        f['COD_A'],
        f['COD_B'],
        f['COD_D'],
        f['COD_L'],
        f['COD_M'],
        f['COD_N'],
        f['COD_P'],
        f['COD_Q'],
        f['COD_R']
    ]
    
    // // Concatenate values to string
    var concat_str = Trim(Concatenate(concat_arr, ''))
    
    // // Add concat field to feature dict
    feat['attributes']['concat_vals'] = concat_str
    
    Push(
        out_dict['features'],
        feat
    )
}

// Return populated dict
return FeatureSet(Text(out_dict))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tested this against another layer, and it successfully returns a "concat_vals" field, which your chart would then be able to see.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_0-1648158567073.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/37308i8716838D6E279419/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jcarlson_0-1648158567073.png" alt="jcarlson_0-1648158567073.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 24 Mar 2022 21:49:44 GMT</pubDate>
    <dc:creator>jcarlson</dc:creator>
    <dc:date>2022-03-24T21:49:44Z</dc:date>
    <item>
      <title>How to concatenate fields to show Graph...</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/how-to-concatenate-fields-to-show-graph/m-p/1157565#M6041</link>
      <description>&lt;P&gt;Hi Folks,&lt;/P&gt;&lt;P&gt;I have this expression on my map popup window to show in one field, the content from 8 different fields (see screenshot below):&lt;/P&gt;&lt;P&gt;Trim(Concatenate([$feature["COD_A"],&lt;BR /&gt;$feature["COD_B"],&lt;BR /&gt;$feature["COD_D"],&lt;BR /&gt;$feature["COD_L"],&lt;BR /&gt;$feature["COD_M"],&lt;BR /&gt;$feature["COD_N"],&lt;BR /&gt;$feature["COD_P"],&lt;BR /&gt;$feature["COD_Q"],&lt;BR /&gt;$feature["COD_R"],&lt;BR /&gt;], ''))&lt;/P&gt;&lt;P&gt;I'm trying to create a graph on my dashboard to show exactly this expression (See the screenshot with the Pie Chart as example). The graph will show how many variations of the codes are in the database (ex. LR - 10, BQ-5, RB-2, D-15, etc.). The field expression is not available in Dashboards, so I can't use the expression. I tried Data Expressions but I can't figure out how to do it.&lt;/P&gt;&lt;P&gt;Can you help me to figure out how to achieve this? thanks in advance!&lt;/P&gt;&lt;P&gt;Milton&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2022 21:19:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/how-to-concatenate-fields-to-show-graph/m-p/1157565#M6041</guid>
      <dc:creator>MiltonSolano</dc:creator>
      <dc:date>2022-03-24T21:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to concatenate fields to show Graph...</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/how-to-concatenate-fields-to-show-graph/m-p/1157593#M6044</link>
      <description>&lt;P&gt;Data Expressions can be a lot to wrap your head around, but it's totally the way to go. This will allow you to create a "virtual" field in your data that a chart can interact with.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var fs = FeatureSetByPortalItem(
    Portal('your-portal-url'),
    'itemid of feature service',
    0, // or whatever the layer index
    ['*'],
    false
)

// Get existing fields
var fields = Schema(fs)['fields']

// Push new feature into field array
Push(
    fields,
    {name: 'concat_vals', type: 'esriFieldTypeString'}
)

// Create dictionary to hold output features
var out_dict = {
    fields: fields,
    geometryType: '',
    features: []
}

// Iterate over features, concatenating fields and pushing into feature array
for (var f in fs){
    
    // Get feature as dict
    var feat = Dictionary(Text(f))
    
    // // Values to concatenate
    var concat_arr = [
        f['COD_A'],
        f['COD_B'],
        f['COD_D'],
        f['COD_L'],
        f['COD_M'],
        f['COD_N'],
        f['COD_P'],
        f['COD_Q'],
        f['COD_R']
    ]
    
    // // Concatenate values to string
    var concat_str = Trim(Concatenate(concat_arr, ''))
    
    // // Add concat field to feature dict
    feat['attributes']['concat_vals'] = concat_str
    
    Push(
        out_dict['features'],
        feat
    )
}

// Return populated dict
return FeatureSet(Text(out_dict))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tested this against another layer, and it successfully returns a "concat_vals" field, which your chart would then be able to see.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_0-1648158567073.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/37308i8716838D6E279419/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jcarlson_0-1648158567073.png" alt="jcarlson_0-1648158567073.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2022 21:49:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/how-to-concatenate-fields-to-show-graph/m-p/1157593#M6044</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-03-24T21:49:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to concatenate fields to show Graph...</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/how-to-concatenate-fields-to-show-graph/m-p/1157832#M6053</link>
      <description>&lt;P&gt;Wonderful Josh,&lt;/P&gt;&lt;P&gt;it worked straight from the forum! Thank you for taking the time to help with this.&lt;/P&gt;&lt;P&gt;Milton&lt;/P&gt;</description>
      <pubDate>Fri, 25 Mar 2022 14:47:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/how-to-concatenate-fields-to-show-graph/m-p/1157832#M6053</guid>
      <dc:creator>MiltonSolano</dc:creator>
      <dc:date>2022-03-25T14:47:09Z</dc:date>
    </item>
  </channel>
</rss>

