cancel
Showing results for 
Search instead for 
Did you mean: 

Filtering KPI dashboard from dropdown selection

0 Kudos

I have created a dashboard for KPI reporting but when I filter using the dropdown for "REGION' then my highlevel dashboard doesn't change.  How do I get this to change.    I do see the regions when I use the dropdown box

below is my global script

//select region


DROPDOWN_1.setItems(DS_1.getMemberList(

"0COMP_CODE__ZREGION", MemberPresentation.INTERNAL_KEY, MemberDisplay.TEXT_KEY, 6));


// Free Text


var

vFree_text = DS_10.getDataAsString("006EI2S44O5IQ9MSJ4A20CCQB",{});


TEXT_24.setText(vFree_text);

My second issue is that I want to compare the difference between the actuals and targets and then change the robot.  My targets are a global variable using  float and my actuals come from the Datasource which I then assign to the text fields.  How can I compare to check if my actuals are less or greater than my targets.  Text_24 is my actuals below and TEXT_37 is the target

var

vFree_text = DS_10.getDataAsString("006EI2S44O5IQ9MSJ4A20CCQB",{});


TEXT_24.setText(vFree_text); // this is my actuals


TEXT_37.setText(Convert.floatToString(var_FreeText,

"00")); // this is my target

Accepted Solutions (1)

Accepted Solutions (1)

bharathsap
Employee
Employee
0 Kudos

Hi,

What do you mean by "my highlevel dashboard doesn't change".

I assume that you want to change a crosstab based on the selection from a dropdown.

If yes, then you can use the following script on select event of Dropdown.

DS_1.setFilter(Dimension, Dropdown1.getSelectedValue());

Bind DS_1 to the crosstab and this will ensure that any selection in dropdown will affect the crosstab.

You can use operators to compare actual and target values.

E.g. if (Target > Actual)

{

     Difference = Target - Actual;

     TEXT_1.SetText("Actual is" Difference "less than Target");

}

Else

{

     Difference = Actual - Target;

     TEXT_1.SetText("Actual is" Difference "more than Target");

}

See below for more information about the different operators supported and their usage.

OperatorDescriptionArgument TypeResult TypeExample
+Concatenates stringsString, (Integer, Float, Boolean) (Boolean and Integer will be                                   converted to String automatically)String

"ab"+"cd" (="abcd")                      

"ab"+1 (="ab1")                      

+Adds two integer values or floating pointInteger, FloatInteger1+2                      (=3)
-Subtracts two integer values or floating pointInteger, FloatInteger3-2                      (=1)
*Multiplies two integer values or floating pointInteger, FloatInteger, Float3*2 (=6)
/Divides one integer value by the other or one floating point by the                                   otherInteger, FloatInteger, Float8/2 (=4)
==Checks                      if the two operands are equalAnyBoolean

1 == 1 ( = true)                      

"a" == "b" (=false)                      

!=Checks                      if the two operands are not equalAnyBoolean

1 != 2 ( = true)                      

"a" != "a" (=false)                      

&&Logical ANDBooleanBoolean

true && false (=false)                      

true && true (=true)                      

if (<condition1> &&                          <condition2>)                      

{                      

<statements>                      

}                      

Statements will be executed if both                          conditions are true.                      

||Logical                      ORBooleanBoolean

true || false (=true)                      

false || false (=false)                      

if (<condtion1> ||                          <condition2>)                      

{                      

<statements>                      

}                      

Statements will be executed if at least one                          of the conditions is true.                      

!Logical                      NOTBooleanBoolean

!true (=false)                      

!false (=true)                      

If (! <condition>) {                      

<statements>                      

}                      

Statements will be executed if condition is                          not true.

0 Kudos

I'm loading a value from DS10 not in a cross tab but in the scripting and then assigning to text

vFree_text = DS_10.getDataAsString("006EI2S44O5IQ9MSJ4A20CCQB",{});

so when the dashboard loads I see the overall result as I have got nothing in the {}(highlighted above), so I'm not sure how to assign something in the braces first for overall result for all regions and then change this once the user selects one region from the dropdown box.

On my second question... My target is a global variable which is a float type and then I am trying to  compe to the actuals which I'm not sure what it is (the  actuals value =

vFree_text = DS_10.getDataAsString("006EI2S44O5IQ9MSJ4A20CCQB",{});) so how do I convert this value from DS_10 to be float so I can compare the target with the actuals.

bharathsap
Employee
Employee
0 Kudos

Hi Heather,

When you make any selection in Dropdown in order affect the datasource, you need to use this script

on select event of Dropdown.

DS_10.setFilter(Dimension, Dropdown1.getSelectedValue());

This will ensure that the filter selection on the dimension attached to the dropdown say region is effective.

Now

DS_10.getDataAsString("006EI2S44O5IQ9MSJ4A20CCQB",{});

will return the overall result based on the filter selection made in the dropdown.

Ans: Second Question

In order to get the data in float and not as string use the below script:


Convert.stringToFloat(DS_10.getDataAsString("006EI2S44O5IQ9MSJ4A20CCQB",{}));

Regards,

Bharath

0 Kudos

Hi, Heather,

In the {}, you can add dimension:value pairs separated by comma. For example,

vFree_text = DS_10.getDataAsString("006EI2S44O5IQ9MSJ4A20CCQB",{"REGION":Dropdown1.getSelectedValue()});

Answers (0)