on 11-30-2015 8:06 PM
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,
%external%.toString().replace( /\:/g, "_" )
Vadim
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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,
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,
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
5 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.