Value not getting updated on click of Column Chart field Links

Certified Senior Developer

I want to save some value on click of various points in a column chart. I have added dynamicLink() component in the chart series, but the value is not getting saved. I'm pasting the code snippet below. Anyone knowing the way out, please help.

load(
local!a,
local!b,
local!c,
{
a!columnChartField(
label: "Multi-Category Chart",
categories: {
"Cat-1",
"Cat-2",
"Cat-3"
},
stacking: "NORMAL",
series: {
a!chartSeries(
label: "Bar-1",
data: {
10, 20, 30
},
links: {
a!dynamicLink(saveInto: save(local!a,"10")),
a!dynamicLink(saveInto: save(local!b,"20")),
a!dynamicLink(saveInto: save(local!c,"30"))
}
),
a!chartSeries(
label: "Bar-2",
data: {
20, 10, 30
}
),
a!chartSeries(
label: "Bar-2",
data: {
40, 10, 15
}
)
}
),
a!textField(value: local!a)
})

  Discussion posts and replies are publicly visible

Parents
  • load(
      local!a,
      local!b,
      local!c,
      local!data: {
        {
          data: {
            10,
            20,
            30
          }
        },
        {
          data: {
            20,
            10,
            30
          }
        },
        {
          data: {
            40,
            10,
            15
          }
        }
      },
      local!label: {
        "Bar-1",
        "Bar-2",
        "Bar-3"
      },
      {
        a!columnChartField(
          label: "Multi-Category Chart",
          categories: {
            "Cat-1",
            "Cat-2",
            "Cat-3"
          },
          stacking: "NORMAL",
          series: {
            a!forEach(
              items: local!data,
              expression: a!chartSeries(
                label: local!label[fv!index],
                data: fv!item.data,
                links: a!forEach(
                  items: local!data,
                  expression: a!dynamicLink(
                    saveInto: {
                      a!save(
                        local!a,
                        10
                      ),
                      a!save(
                        local!b,
                        20
                      ),
                      a!save(
                        local!c,
                        30
                      )
                    }
                  )
                )
              )
            )
          }
        ),
        a!textField(
          value: local!a
        )
      }
    )

Reply
  • load(
      local!a,
      local!b,
      local!c,
      local!data: {
        {
          data: {
            10,
            20,
            30
          }
        },
        {
          data: {
            20,
            10,
            30
          }
        },
        {
          data: {
            40,
            10,
            15
          }
        }
      },
      local!label: {
        "Bar-1",
        "Bar-2",
        "Bar-3"
      },
      {
        a!columnChartField(
          label: "Multi-Category Chart",
          categories: {
            "Cat-1",
            "Cat-2",
            "Cat-3"
          },
          stacking: "NORMAL",
          series: {
            a!forEach(
              items: local!data,
              expression: a!chartSeries(
                label: local!label[fv!index],
                data: fv!item.data,
                links: a!forEach(
                  items: local!data,
                  expression: a!dynamicLink(
                    saveInto: {
                      a!save(
                        local!a,
                        10
                      ),
                      a!save(
                        local!b,
                        20
                      ),
                      a!save(
                        local!c,
                        30
                      )
                    }
                  )
                )
              )
            )
          }
        ),
        a!textField(
          value: local!a
        )
      }
    )

Children
  • 0
    Certified Lead Developer
    in reply to Krishna Chaitanya

    Note that with this code, the "a!forEach" call you've added doesn't do very much, because it's saving the same hardcoded values into the three local variables (a - c) regardless of which item in the chart is clicked.

    If you wish to populate these with the actual column data when clicked, you'd replace the hardcoded values with fv!item.data[index], as below:

    load(
      local!a,
      local!b,
      local!c,
      local!data: {
        {
          data: {
            10,
            20,
            30
          }
        },
        {
          data: {
            20,
            10,
            30
          }
        },
        {
          data: {
            40,
            10,
            15
          }
        }
      },
      local!label: {
        "Bar-1",
        "Bar-2",
        "Bar-3"
      },
      {
        a!columnChartField(
          label: "Multi-Category Chart",
          categories: {
            "Cat-1",
            "Cat-2",
            "Cat-3"
          },
          stacking: "NORMAL",
          series: {
            a!forEach(
              items: local!data,
              expression: a!chartSeries(
                label: local!label[fv!index],
                data: fv!item.data,
                links: a!forEach(
                  items: local!data,
                  expression: a!dynamicLink(
                    saveInto: {
                      a!save(
                        local!a,
                        fv!item.data[1]
                      ),
                      a!save(
                        local!b,
                        fv!item.data[2]
                      ),
                      a!save(
                        local!c,
                        fv!item.data[3]
                      )
                    }
                  )
                )
              )
            )
          }
        ),
        a!textField(
          value: "a: " & local!a & char(10) &
            "b: " & local!b & char(10) &
            "c: " & local!c,
          readOnly: true()
        )
      }
    )

  • 0
    Certified Senior Developer
    in reply to Krishna Chaitanya

    Yes, I have a!save in my code, but still not working.

  • 0
    Certified Lead Developer
    in reply to sudip.das005

    Please try the example I provided above (perhaps in a new interface editor) and see if it does what you were hoping for (since i'm a little unclear on what your desired outcome is) -- and see if it might help you figure out how to correctly implement your saves.