cancel
Showing results for 
Search instead for 
Did you mean: 

JS ternary operator error in conversion file

akos_beres
Contributor
0 Kudos

Hello,

I'm trying to solve for a scenario where a master data field (intercompany) can be various lengths. I'd like to map anything over 4 digits to IC_NONE and anything under 4 digits to a specific syntax. When I run the following JS:

js:((parseInt(%external%)>9999) ? "IC_NONE" : "IC_"+("0000"+%external%.toString()).slice(-4))

I'm receiving the following error:

Number of '?' markers in external (?*) and internal (?JS:((parseInt(%EXTERNAL%)>9999) ? "IC_NONE" : "IC) must be equal

Any thoughts or suggestions?

Thanks in advance!

Akos

System: BPC 10.0 NW; BW 7.4 SP03

former_member186338
Active Contributor
0 Kudos

sorry, but what do you have in external field?

Accepted Solutions (1)

Accepted Solutions (1)

former_member186338
Active Contributor
0 Kudos

Try:

External: *

Internal: JS:(parseInt(%external%)>9999) ? "IC_NONE" : "IC_"+("0000"+%external%.toString()).slice(-4)

"?" - has also a special meaning in External...

P.S. "System: BPC 10.0 NW; BW 7.4 SP03"

BPC SP???

BW 7.4 SP03 - so old???

akos_beres
Contributor
0 Kudos

Vadim,

thanks for the helping hand! When you asked me to switch to the Internal column in conversion file, I remembered that I need to flip the CONVERT_INTERNAL parameter on the transformation file to NO. When I went to the file, I realized that I didn't have the parameter listed at all. Once I added it, the error went away. The interesting thing is that I had another statement ("IC_"+("0000"+%external%.toString()).slice(-4)) there before that didn't include a ternary operator and that worked without the parameter in the transformation file. Anyway the issue is resolved now ... thank you!

The solution working solution is :

Couple of the other follow-ups:

1. the error I pasted showed (?*) ... I was just trying to manipulate the external column ... I only had * before and gave me the same error

2. BPC SP??? it is 801 SP0004 ( as you said super old)

BW 7.4 SP03 - so old??? ... the upgrade is in the works, the EPM version is also very old (SP15) as well so it's quite entertaining to work out issues that SAP solved 4 years ago but you can't fix because you can't update the plug-in. Although it should be solved in a few months as well!

former_member186338
Active Contributor
0 Kudos

akos.beres

I think that your issue is related to very old SP for BPC, BW and EPM

Answers (0)