SAP Knowledge Base Article - Public

3491482 - getAllComments API returns undefined in SAP Analytics Cloud (SAC)

Symptom

The getAllComments() API does not return the empty array as expected. Instead, it returns undefined.

Reproducing the Issue

  1. Use the getAllComments() API in the scripting.
  2. Run this app or story.

Cause

It is by design that the getAllComments API may return as undefined if the selection doesn't have any comment.

Resolution

Th is by design. If you want to use the IF statement to judge whether the selection has any comment or not, you can use the following code as an example:

  • allComments = table.getComments().getAllComments(selection[i]);
    if (allComments && allComments.length>0) {
        ...
    }

Keywords

Cannot read properties of undefined (reading 'length') ,  scripts, script, code, codes, coding, SAP Cloud for Planning, sc4p, c4p, cforp, cloudforplanning, Cloud for Analytics, Cloud4Analytics, CloudforAnalytics, Cloud 4 Planning, BOC, SAPBusinessObjectsCloud, BusinessObjectsCloud, BOBJcloud, BOCloud., SAC, SAP AC, Cloud-Analytics, CloudAnalytics, SAPCloudAnalytics,Error, Issue, System, Data, User, Unable, Access, Sac, Acquisition, Model, Connect, Story, Tenant, Import, Failed, Using, Working, SAP Cloud for Planning, sc4p, c4p, cforp, cloudforplanning, Cloud for Analytics, Cloud4Analytics, CloudforAnalytics, Cloud 4 Planning, BOC, SAPBusinessObjectsCloud, BusinessObjectsCloud, BOBJcloud, BOCloud., SAC, SAP AC, Cloud-Analytics, CloudAnalytics, SAPCloudAnalytics,Error, Issue, System, Data, User, Unable, Access, Connection, Sac, Connector, Live, Acquisition, Up, Set, setup, Model, BW, Connect, Story, Tenant, Import, Failed, Using, Working, SAML, SSO, sapanalyticscloud, sap analytical cloud, sap analytical cloud, SAC, sap analyst cloud, connected, failure, stopped, sap analyst cloud, https://hcs.cloud.sap, https://hanacloudservices.cloud.sap, https://cloudanalytics.accounts.ondemand.com, https://hanacloudservices-us.accounts.ondemand.com, https://www.sap.com, https://help.sap.com, predictive analytics (analysis), data analysis (analytics) tools, analytics tools, sap analytics cloud, data literacy, advanced analytics, data democratization, analytics software, real time analytics, self service analytics, advanced data analytics, analytics as a service, analytics cloud / cloud analytics, saas analytics, cloud bi, enterprise planning, cloud data analytics, cloud based analytics, analytics cloud platform, modern analytics, real time analysis, cloud analytics solution(s), what is sap analytics cloud, cloud analytics tools, analytics in the cloud, cloud analytics software, dashboard , KBA , LOD-ANA-AD-INF , Analytics Designer Infrastructure , Problem

Product

SAP Analytics Cloud 1.0