cancel
Showing results for 
Search instead for 
Did you mean: 

Conversion in BPC 10

Former Member
0 Kudos

Hi,

I am loading master data in one of the dimensions of model from BW info object. I am coming across one issue with colon (:).

While loading from BW info object, I am getting many records with Colon (:). Ex

CC_T6H11O1:DE:NP

CC_T6H12O1:DE:NP

There are several as above.

From my side, I tried all possible alternatives to remove colon sign (:) and load in the dimension such as using java script: Replace, Split. I was not successful to get rid of this issue. It keeps throwing me error as below-

"Dimension Member CC_T6H11O1:DE:NP is an invalid member" //there are plenty of the errors like them.

Has anyone faced this issue, please share you solution or suggestion.

My aim is to load them after removing colon (:) and replace it with underscore (_).

Regards,

Accepted Solutions (1)

Accepted Solutions (1)

former_member186338
Active Contributor
0 Kudos

%external%.toString().replace( /\:/g, "_" )

Vadim

former_member186338
Active Contributor
0 Kudos

P.S. And please show your transformation and conversion files...

Former Member
0 Kudos

Thanks for reply, Vadim. I have already tried this one, but it did not work for me. In conversion file, what I used is as below

Internal    External                                        Formula

*                js:%external%.replace(":","_")

*                js:%external%.split(':').join('_')

I didn't use toString(). After this thread, I added toString() as well in my conversion file, same errors are still occurring.

I am attaching transformation and conversion.

Regards,

former_member186338
Active Contributor
0 Kudos

Ups, you have to combine your replacements in the single javascript line. Or only first will be processed!

former_member186338
Active Contributor
0 Kudos

Like:

*       %external%.toString().replace(/\:/g,"_").replace(/\s/g,"").replace(/\//g,"").replace(/\\/g,"")

First - *SKIP lines, then replace...

former_member186338
Active Contributor
0 Kudos

P.S. Or more compact:

%external%.toString().replace(/\:/g,"_").replace(/[\s\\\/]/g,"")

Former Member
0 Kudos

As usual, This worked very well. Thanks a lot Vadim.

One question regarding to this, When I used java script as below then I got rid of Colon, but now space appeared in the ID member, which I earlier removed through java script Split(' ').Join(''). I am confused that why did this happen.

js:%external%.toString().replace(/\:s+/g,"")

However, it got resolved when I combined it (split().join()) with replacement in one java script.

you have shared one compact java script examples (%external%.toString().replace(/\:/g,"_").replace(/[\s\\\\/]/g,""). Confusion is

1.     Why did you use two replacements and combine them? Wouldn't that overlap? First underscore and then removing underscore in 2 replacement.

2.     Why did you use special character i.e. / and \ multiple time like \s\\\\ and /]/?

3.     Does using special characters multiple time in one replacement mean something.

Thanks once again..

Regards,

former_member186338
Active Contributor
0 Kudos

Hi David,

First of all I recommend you to use any online JavaScript testing page!

1. Why did you use two replacements and combine them? Wouldn't that overlap?

First will replace ":" with "_"

Second will replace "\s" - space, "\\" - "\", "\/" - "/" with NOTHING - ""

(%external%.toString().replace(/\:/g,"_").replace(/[\s\\\\/]/g,"") - Error!  has to be: .replace(/[\s\\\/]/g,"")

2.     Why did you use special character i.e. / and \ multiple time like \s\\\\ and /]/?

I use "\" before special characters

3. Does using special characters multiple time in one replacement mean something.

Not multiple times, each character has a special meaning.

Please read any online JavaScript manual about regular expressions!

Vadim

former_member186338
Active Contributor
0 Kudos

For example: JavaScript RegExp Object

Online testing page is also here!

Former Member
0 Kudos

Thanks Vadim, This is very useful information.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi David,

You can also use this line in the conversion file if you want to replace the : with an _

js:%external%.toString().split(":").join("_")

Andy

Former Member
0 Kudos

Thanks Andy for response,

I have already applied this java script (Split & Join), but it did not help me in case of colon ":". for other special characters such as -, space etc, it worked. But not for colon ":"

Regards,