Skip to Content
Author's profile photo Former Member

To set Decimal Places in Design Studio

Hi All,

This document helps you to set Decimal places with Percentage in design studio by using Script.

Requirement:-

Create a Column Chart which shows data in decimal places.


         /wp-content/uploads/2014/07/1_506686.jpg



Steps:-

  1. Drag a column chart in to the application
  2. Assign Data source to it.
  3. Go to chart properties and disable the show value inside option.
  4. As we all know while setting decimal places in  the datasource (edit initial view) doesn’t make any changes, please find below link for the same

http://scn.sap.com/thread/3464895


       /wp-content/uploads/2014/07/2_506682.jpg


   5.  So the alternative way to make decimal places by  using script in Onstartup event.

   6.  For that we will drag text box on the Column chart, and assign default text (in decimal) for design view purpose

      /wp-content/uploads/2014/07/3_506683.jpg

  

   7.  Go to Application =>Event => On startup

   8.  Write a script to convert result to decimal number.

   9.  Create a variable, assign data to it and use convert function to that variable. Assign value of result to text box.


     /wp-content/uploads/2014/07/4_506684.jpg


  10.  Execute

    

       /wp-content/uploads/2014/07/5_506685.jpg


  11. While executing the Application it automatically pick the result from datasource. As I have assign 142.17 as default value in the text box in design mode, which automatically get updated by the Onstartup event on successful execution of dashboard.


  12.Similarly for Percentages (%):

                                        For example- If you want to show variance percentage between two column i.e. A and B

                                  var ZYOY1_VARIENCE = (DS_1.getData(“A”, {}).value – DS_1.getData(“B”, {}).value) / DS_1.getData(“A”, {}).value * 100;

                                  TEXT_PERCENTAGE.setText(Convert.floatToString(ZYOY1_VARIENCE,”#0.0″)+ “%”);

   13. Similarly we can do for Variance(-):

                                                  For example- If you want to show difference between two column A and B

                              var ZYOY1_VARIENCE = (DS_1.getData(“A”, {}).value – DS_1.getData(“B”, {}).value)

                              TEXT_Variance.setText(Convert.floatToString(ZYOY1_VARIENCE,”#0.0″);

Hope this helps….

Regards,

Tulika

Assigned Tags

      7 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Arjun K T
      Arjun K T

      Hello TULIKA RANI SHAW,

      Nice blog and helpful . I have a question if the column chart bar size reduces based on filtering then how we can change the position of the text box dynamically ?

      Thanks & Regards

      Arjun KT

      Author's profile photo Karol Kalisz
      Karol Kalisz

      Hi,

      moving of components can be done also in standard. you just need to use the funtion

      TEXT_PERCENTAGE.setTopMargin(here comes a number which you need to calculate);


      Regards, Karol

      Author's profile photo Former Member
      Former Member

      Very much informative blog... keep posting.. 🙂

      Author's profile photo Mathan Msd
      Mathan Msd

      Nice blog...

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      10Q Mathan

      Author's profile photo Juan ElĂ­as Rivero DomĂ­nguez
      Juan ElĂ­as Rivero DomĂ­nguez

      It's useful in 1.6 version too.

       

      Thanks for share it.

       

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Thanks Juan