cancel
Showing results for 
Search instead for 
Did you mean: 

Use SAP Analytics Cloud Analytics Designer Script Editor as Chart Data Source

apurgert
Newcomer
0 Kudos

We have a requirement to build an SAC story that will:

  1. Count the number of new maintenance notifications
  2. Count the number of closed notifications
  3. Count the number of weeks a notification was open

Leveraging OData service C_ObjPgMaintNotification as the Model, I have been able to create additional columns in the model that calculate the week based on the date.  For example, a notification opened January 1, 2024 will show a start week of December 31, 2023 and end week of January 6, 2024.  The same is true for a completed notification.

I have used the SAC Analytics Designer to build three key-value pair dictionaries that will hold the start week and the count of new, open, and closed notifications (newNotificationsByWeek, openNotificationsByWeek, and closedNotificationsByWeek).  New and closed notifications are easy to get as they are dimensions in the model.

For open notifications, I have the SAC Analytics Designer loop through the notifications and add to the count for the respective week.  If we had a notification opened January 1, 2024 and closed February 1st, 2024 and a second notification opened January 18 and closed January 29, the output would look like this:

 

newNotificationsByWeek
Sun Dec 31 2023: "1"
Sun Jan 07 2024: "0"
Sun Jan 14 2024: "1"
Sun Jan 21 2024: "0"
Sun Jan 28 2024: "0"
openNotificationsByWeek
Sun Dec 31 2023: "1"
Sun Jan 07 2024: "1"
Sun Jan 14 2024: "2"
Sun Jan 21 2024: "2"
Sun Jan 28 2024: "0"
closedNotificationsByWeek
Sun Dec 31 2023: "0"
Sun Jan 07 2024: "0"
Sun Jan 14 2024: "0"
Sun Jan 21 2024: "0"
Sun Jan 28 2024: "2"

 

Now the issue that I have is how can I use the key-value pairs in a chart?  I have tried to loop through them and use API calls such as Chart.addDimension(), Chart.addMember, etc. but these appear to only allow dimensions and measures that are part of the model.  I looked to see if there was a way to push the values to a separate dataset or model and use that as the chart, but that doesn't seem to be possible.

Is there a way to use script variables as the chart's data source so that a bar chart with the date along the x-axis and count on the y-axis can be viewed?

Accepted Solutions (0)

Answers (0)