Make Your BIAL Script Better Avoiding Hardcoding
Filter BW Query Key Figure Structure or apply BW Query Condition is a common requirement for BIAL Script. What developers tend to do is to quickly hardcode technical names, but on the long it will make support and maintenance an issue. Here are disadvantages of hardcoding technical names:
- Technical name are cryptic and make your code not readable;
- Technical name changes require BIAL script update;
- Condition technical name is not available in BW Query designer.
In my blog I will explain how to use simple BIAL Script functions to get technical names for BW Query Key Figure, BW Query Condition and BW Query Exception.
Get_Measure_Member_Id
Get_Measure_Member_Id script function gets DataSource and Key Figure name as an input and returns Key Figure technical name
Note: make sure that Key Figure names are unique in your BW Query
Below is an example how to use above function to get BW Key Figure technical names:
Note: if BW Query Key Figure name is spread between multiple lines, then in BIAL script CR LF should be coded as \r\n
Get_Measure_Filter_Id
Get_Measure_Filter_Id script function gets DataSource and Condition name as an input and returns Condition technical name.
Note: make sure that Condition names are unique in your BW Query
Below is an example how to use above function to get BW Condition Technical Name:
Get_Conditional_Format_Id
Get_Conditional_Format_Id script function gets DataSource and Conditional Format Name as an input and returns Condition Format technical name.
Below is an example how to use above function to get BW Conditional Format technical name: