Dynamic Link in a Column chart from a Record type

Certified Associate Developer

I am attempting to make a chart where the user can click on a chart to open another chart for a drill down.  In my example Jack-001 has 2 events associated with it and I would like to click on it and see the details of those events.

{
  a!columnChartField(
    data: 'recordType!{39c31005-7637-4eb1-8a4c-cc1cd5cfa952}sam_failure_analysis1',
    config: a!columnChartConfig(
      primaryGrouping: a!grouping(
        field: 'recordType!{39c31005-7637-4eb1-8a4c-cc1cd5cfa952}sam_failure_analysis1.fields.{equipNo}equipNo',
        alias: "controlNo"
      ),
      measures: a!measure(
        function: "COUNT",
        field: 'recordType!{39c31005-7637-4eb1-8a4c-cc1cd5cfa952}sam_failure_analysis1.fields.{failureMode1}failureMode1',
        alias: "controlNo_count"
      ),
      dataLimit: 100
    ),
    label: "Column Chart",
    series: {
      a!chartSeries(label: "Chart Series", data: {1, 2, 3})
    },
    stacking: "NONE",
    showLegend: true,
    showTooltips: true,
    labelPosition: "ABOVE",
    colorScheme: "CLASSIC",
    height: "MEDIUM",
    xAxisStyle: "STANDARD",
    yAxisStyle: "STANDARD"
  )
}

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    I notice you don't have any links defined yet in the code you posted (either in a!chartSeries or in a!columnChartConfig) - have you tried anything yet?  You'll want a dynamic link somewhere that saves the context of the bar you're clicking into some local variable that can then be used to identify what additional content to show on your interface.  I don't have a handy example off-hand, though if you search within the appian documentation for chart recipes, i'm guessing some of the ones they have set up will demonstrate how to set this up.

  • 0
    Certified Associate Developer
    in reply to Mike Schmitt

    Thank you.  I had attempted to modify some of the recipes, see below, but without success.   When I attempt to click on the chart, nothing is saved into the local variable.

  • 0
    Appian Employee
    in reply to AllenP

    Can you confirm which version of Appian you're using? Support for links was released in 21.1, so you'll need to be on that version for it to work.

  • 0
    Certified Associate Developer
    in reply to Peter Lewis

    version 20.4

    We have gotten the below to work, but only on the first column and it puts all data in the rule input.

    a!localVariables(
      local!pagingInfo: a!pagingInfo(
        startIndex: 1,
        batchSize: - 1,
        sort: {}
      ),
      local!datasubset: a!queryEntity(
        entity: cons!sam_failure_analysis1,
        query: a!query(
          aggregation: a!queryAggregation(
            aggregationColumns: {
              a!queryAggregationColumn(
                field: "equipNo",
                isGrouping: true
              ),
              a!queryAggregationColumn(
                field: "failureMode1",
                aggregationFunction: "COUNT"
              )
            }
          ),
          pagingInfo: local!pagingInfo
        ),
        fetchTotalCount: false
      ),
      {
        a!columnChartField(
          categories: {
            index(
              local!datasubset.data,
              "equipNo",
              null
            )
          },
          series: {
            a!chartSeries(
              label: "Failure Mode #1",
              data: index(
                local!datasubset.data,
                "failureMode1",
                null
              ),
              links: a!dynamicLink(
                label: "D Link",
                value: local!datasubset.data,
                saveInto: ri!equipment
              )
            )
            
          },
          colorScheme: "CLASSIC",
          height: "MEDIUM",
          xAxisStyle: "STANDARD",
          yAxisStyle: "STANDARD"
        )
      }
    )

  • 0
    Certified Lead Developer
    in reply to AllenP

    The way you have your link set up, it will be saving all data in local!datasubset.data into ri!equipment, so I'm not sure why you would be expecting otherwise.  Also, 20.4 is lower than 21.1 so I'm unclear whether the functionality you're expecting to find will be available or supported. 

    And as an aside, when posting rather lengthy code like this, it would help us out if you use a Code Box, found in the "Insert" menu of the comment editor here.

  • 0
    Certified Associate Developer
    in reply to Mike Schmitt

    I apologize for that, I will do that in the future.