Technical Articles
Dynamic Calendar Implementation
Custom Dynamic Calendar Implementation
(SAC Application Designer)
Background :
In SAC Implementation Projects, there will be requirements to enhance the existing standard features of SAC Dashboard/Story. SAC Application Designer Plays a key role in meeting the dynamic requirements. The requirement discussed in this Blog is, “How to Implement a Dynamic Calendar”.
Based on the User selection of drop down – it should fetch the respective calendar of the year/month. This will open up additional features like performing tasks based on the Calendar Date. selection like showing Chart.
Please note there is no standard APIs available yet. Hence, we will have to develop a custom code to meet this requirement. This Blog describes, how to implement a custom Dynamic calendar using the SAC application designer features.
( *Source Image : Custom developed in SAC by Giri -SAP )
Business Use case:
When the User selects the date from calendar, corresponding Analysis shown on the Graph. Instead of Chart, we can also apply required widgets like Table and so on. The Main Logic explained here is Custom Logic on calendar build.
In General, Application Designer is used to build a story in a self-service workflow and can be made up of various widgets and a lot of configured functionality. However, the amount of customization is limited to the foreseen possibilities offered in the story design-time environment.
An analytic application typically contains some custom logic, expressed with the help of scripts. With analytic applications there is much more flexibility to implement custom behavior.
Approach: / Code Snippet:
-
- Design cells using Input Fields.
- Design custom function as shown below.
- Pass the selection Parameter to the Graph for filtering selection-based Analysis.
- The Push button will pass the required parameters to the custom function, which triggers calendar based on the date selected in calendar cell.
- The below custom function gets the Drop down selection as a input and process it and outputs the first day / last day of a month. This will be consumed in the ‘write days function.
- The function named ‘write days’ consists of a core logic of writing the days/dates in the respective cells. The month tab will respond to the selections of the users and enable accordingly. This can be optimized by utilize dynamic object creation.
Conclusion:
This Custom code will enable the developers to use and enhance for their changing Business requirements. The main reason for keeping the “Fetch Calendar” – Push button is to make use of the enhancing code inside the ‘Push button’ code area and accommodate navigate to different SAC Widgets.
*Please watch out this space for – Integrating with ‘R’ Visualization in Upcoming Blog.
( *Source code & Images : Custom developed in SAC by Giri -SAP )
Hi Giri, could you please help me with entire code an design. I need to develop it for one of my enhancement where my model date dimension granuality is set to month level.
I need to add 365 input cell in this case right?
What is the third argument in getFirstdayofMonth?
Have u hardcoded the vale for drop down?
How it will hold good for leap year?
What is the functionality of resetdata. Could you please provide the code?
Thanks