In this blog post, I will provide you with a comprehensive and step-by-step explanation of how to retrieve property values from any dimension within SAP Analytics Cloud (SAC). I will walk you through the intricacies of the process, ensuring a thorough understanding of the methods and techniques involved.
There was already an easier way to retrieve properties using the Planning Model’s getMembers() method. However, with the 2023 Q4 update, they may restricted access to master data for non-generic dimensions. As a result, we had to find an alternative method to obtain properties from dimensions, which led us to using tables in stories or analytical applications. Let’s get started.
2. Show the property of the dimension:
3. Create a button and add the following JavaScript code:
Insert the following code in the onClick function:
/*
var selection = {
"DIMENSION_NAME": "PROPERTY_ID"
};
*/
var selection = {
"Version": "public.Actual"
};
var resultSet = Table_1.getDataSource().getResultSet(selection, 0, 1);
// Log the entire result set to the console
console.log(resultSet);
// Access the specific property value (e.g., START_DATE) from the result set
/* var startDate = resultSet[0]["DIMENSION_NAME"].properties["DIMENSION_NAME.PROPERTY_ID"]; */
var startDate = resultSet[0]["Version"].properties["Version.START_DATE"];
// Log the property value to the console
console.log(startDate);
// Output: 202312
Console Output
The provided JavaScript code demonstrates how to obtain property values from the ‘Version’ dimension in SAC. First, we create a selection object specifying the desired dimension value. We then use the getResultSet() method to retrieve the data, limiting the result to one entry. Finally, we access the specific property value, in this case, ‘START_DATE’, from the result set and log it to the console.
By following these steps and utilizing the provided code, you can efficiently retrieve property values from any dimension in SAP Analytics Cloud. This method provides a reliable solution even after the 2024 Q4 update restrictions.