Skip to Content
Author's profile photo Tammy Powlas

Design Studio: On Variable Initialization – Learning from Learning Hub

So I am learning more about Design Studio from Learning Hub.  You can learn more about Learning Hub here Getting access & accessing SAP Learning Hub #SAPEducation

On Variable Initialization is discussed here as well: DS 1.2 – New Event Triggers

First in Learning Hub SAP explains that you can use the On Variable Initialization event to set query variables to “avoid unnecessary round trip to the backend”.  This will set the mandatory variables all at once.  At BI 2014, it was discussed that the mandatory prompt screen may be difficult on your users; so consider possibly not using it and let your users interact with the dashboard directly.

1prompts.PNG

Above is the mandatory prompt screen if I don’t use the On Variable Initialization event.

In this example, I set all mandatory variables using the On Variable Initialization event by first setting the default in a global variable:

2setglobalvar.PNG

I am setting the date to January 31, 2011 as shown above (dates are strings)

3method for event.PNG

Above is where I set up the code to set the value of the variable, which in this case is the value of the global variable g_date.

So when I run the application there are no prompts, which is nice.

4forceprompts.PNG

Note I left the default setting Force Prompts to false.

5promptsappear.PNG

If I set it to true, then the prompt screen is always shown even if I set all mandatory variables in the script.


Related:

If you are an ASUG member consider registering for the webcasts below:


You can learn more about Design Studio, including hands-on experience at this Jump Start ASUG Annual Conference SAPPHIRE with a Pre-Conference Session – Back and Better than Ever

Assigned Tags

      3 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Rama Shankar
      Rama Shankar

      Thanks Tammy! 🙂

      Author's profile photo Marton Horvath
      Marton Horvath

      Hi Tammy, and fellow users

      Thank you for the many articles posted! I would like to add a bit to this: it only works with the data source's "Load in Script" option set to false.

      Unfortunately if you would set "Load in Script" to true, on the first occurance of DS_*.loadDataSource(); the prompt will still appear; even if you have already set the value in the script like above. (Second time it's fine.)

      DS version: 16.2.2

      I have spent a few hours on this 🙂 hopefully you can save it!

      Regards,

      Marton

      Author's profile photo Arpit Arora
      Arpit Arora

      Nice explanation Tammy 🙂

       

      Regards

      Arpit Arora