Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to compute/calculate based on String?

former_member187400
Active Contributor
0 Likes
974

Hi All -

I am working for BPC Embedded Planning BW 7.5.

We have z-table having formula maintained (table name: Formula Builder)

Account (Output)SequenceOperatorAccount Ref.
1001011START30101
1001012PLUS30102
1001013MINUS30103
1001014PLUS30104
1001015END

and we have transaction data (from other table - table name: Transaction Data table):

AccountYearAmount
30101201610
3010220165
30103201620
30104201630

The requirement is to have AMDP with SQL Script to compute Account: 100101 transaction data based on Formula Builder table.

And, I have a plan : to create 1 string, and put all the amount including with the arithmetic (plus, minus, multiply, bracket, etc) into the string, and let standard SQL Function to compute, or handle it.

e.g. the Account 100101 will be computed: 

100101 = 10 + 5 - 20  + 30

100101 = 25

The question is what the standard Function Module, or SQL Command/Syntax to do the computation based on string that I can use in AMDP?

Kindly please ask your thought, and advice,

Many thanks,
Niel

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
918

Hi

try this sql as in the image.you can add the case for div and multiplication also.

Hi All -

I am working for BPC Embedded Planning BW 7.5.

We have z-table having formula maintained (table name: Formula Builder)

Account (Output)SequenceOperatorAccount Ref.
1001011START30101
1001012PLUS30102
1001013MINUS30103
1001014PLUS30104
1001015END

and we have transaction data (from other table - table name: Transaction Data table):

AccountYearAmount
30101201610
3010220165
30103201620
30104201630

The requirement is to have AMDP with SQL Script to compute Account: 100101 transaction data based on Formula Builder table.

And, I have a plan : to create 1 string, and put all the amount including with the arithmetic (plus, minus, multiply, bracket, etc) into the string, and let standard SQL Function to compute, or handle it.

e.g. the Account 100101 will be computed: 

100101 = 10 + 5 - 20  + 30

100101 = 25

The question is what the standard Function Module, or SQL Command/Syntax to do the computation based on string that I can use in AMDP?

Kindly please ask your thought, and advice,

Many thanks,
Niel

2 REPLIES 2
Read only

Former Member
0 Likes
919

Hi

try this sql as in the image.you can add the case for div and multiplication also.

Read only

0 Likes
918

Arun Kumaar Menon wrote:

Hi

try this sql as in the image.you can add the case for div and multiplication also.

Hi Arun -

Thanks for the quick response. However, I found this way is difficult due I will have bracket (  ) , and If statement, and other things. I might go to this way for the last resort.

Hence, I am thinking to put all those amount into 1 string or nvarchar, and need 1 SQL Command to handle the computation.

If you have any thought on this - what is the SQL Command/Syntax, and the sample code, kindly please let me know.

Many thanks,
Daniel.