Introduction
While working with BW Live stories in SAP Analytics Cloud Advanced Mode, I learned that scripting must be defensive, explicit, and user-driven.
In this blog, I share the first three scripting learnings that consistently worked in real projects.
All examples below are error-free and production-safe.
Learning
Text Input widgets always return strings.
Using them directly in calculations or BW variables leads to errors.
Explicit conversion is mandatory.
Working Script Example
// Read value from Text Input
var inputValue = InputField_1.getValue();
// Convert string to number safely
var numericValue = ConvertUtils.stringToNumber(inputValue);
Why this works
Learning
Business users prefer entering simple numbers, such as millions.
BW Live variables expect full numeric values.
The script must handle the conversion.
Working Script Example
// Convert million value to full amount and feed BW variable
Table_Main.getDataSource()
.setVariableValue("VAR_COST_MIN", numericValue * 1000000);
Benefits
Learning
BW Live does not automatically refresh after variable updates.
Refreshing too early or multiple times causes inconsistent behavior.
Always refresh once, after all variables are set.
Working Script Example
// Refresh BW Live data after variable assignment
Table_Main.getDataSource().refreshData();
Best Practice
Conclusion – Part 1
These three learnings form the foundation of stable BW Live scripting:
In Part 2, I will cover advanced but safe patterns for helper tables and dynamic filtering.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 34 | |
| 21 | |
| 17 | |
| 16 | |
| 15 | |
| 15 | |
| 13 | |
| 13 | |
| 12 | |
| 11 |