8 Replies Latest reply: Jul 12, 2017 4:18 AM by dion verbeke RSS

    Trying to include second expression in Waterfall extension.

      Hi all

       

      In Waterfall extension i'm trying to include 2 expressions instead of 1 expression(default in extension code). In below code in bolded area of alert : d[1].qNum gives me all values of first expression, but d[2].qNum doesn't works for me and causing error.

       

      Can anyone suggest me how i can achieve in getting the second expression values in the alert ?

       

      var data = layout.qHyperCube.qDataPages[0].qMatrix

                      .filter(function (d) {

                          return d[0].qText !== undefined;

                      })

                      .map(function (d, i, arr) {

                          return {

                              label: d[0].qText,

                              value: d[1].qNum,

                              element: d[0].qElemNumber,

                            alert : alert(d[1].qNum),

                            alert : alert(d[2].qNum),

                              sum: (i === 0) ? d[1].qNum : arr.map(function (d) {

                                  return d[1].qNum;

                              }).reduce(function (prev, curr, idx, array) {

                                  if (idx > i) return prev

                                  else if ((idx==3 && i==3) || (idx==5 && i==5)) return curr

                                  else if (idx==4 && i==4) return  array[5]; 

                                  return prev + curr

                              })

                          }

                      });

       

      Thank in advance.

       

      Regards,

      Satish A.