SAP Knowledge Base Article - Public

2877442 - How to debug Scripts in Analytics Designer Debug Mode

Symptom

You would like to debug your scripts in Analytics Designer during the runtime.

In below example, the application has two Text widgets and one button.

31.png

The script in the onClick function will copy TextA to TextB.

var text = Text_1.getPlainText();
Text_2.applyText(text);

You want to set a breakpoint before setting the value to Text_2, so that you can watch the value returned by getPlainText for Text_1 during the runtime.

Environment

SAP BusinessObjects Cloud 1.0

Reproducing the Issue

Run the Analytics Application.

Resolution

  1. Add the "debugger;" statement in your scripts
    This statement emulates the creation of a breakpoint in your script. You don't have to explicitly set a breakpoint in a script that needs to be debugged, but the script will automatically halt its execution as soon as the debugger; statement in your script is interpreted.

    var text = Text_1.getPlainText();
    debugger;
    Text_2.applyText(text);

  2. Activate the debug mode by adding the URL parameter debug=true to your analytic application.
    http://<HOST>:<PORT>/sap/fpa/ui/app.html?tenant=<TENANT_NAME>#;mode=present;view_id=appBuilding;appId=<APPLICATION_ID>;debug=true
  3. Press F12 to open the development tools of the Web browser (Google Chrome).
  4. Click the button to call onClick function, the development tools view shows "Sources" tab and stopped at "debugger;" statement.
    33.png
  5. In the file tree on the left side, expend sandbox.worker.main. Under AnalyticApplication, you'll find the folder with your application's name. You'll find the scripts that you've already executed for your current application in this folder.
  6. You can click the line to add a breakpoint.
  7. You can use the debug buttons on the right top side. For example, step over, step into.
  8. You can add watch expressions in "Watch" section.

Keywords

SAC, SAP Analytics Cloud, Analytics Application Designer, API , KBA , LOD-ANA-BI-APP , Analytics Designer and Data Analyzer , How To

Product

SAP Analytics Cloud 1.0