on 09-10-2014 4:16 PM
Hello,
I have a senario where in I have an ID defined as (ID=0CO_AREA+*STR(_)+ID)
Transformation file for ID
ID=0CO_AREA+*STR(_)+ID
In Conversion file
NODENAME=NODENAME (Since the hierarchy already contains the Controlling area)
Now using Java script I want to split the hierarchy code with "_" between the Controlling area and ID. The ID length is not fixed.
Regards
Hi Mahesh,
The requirement is not clear: first you combine, then you want to split... how do you want to use split result?
Vadim
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Vadim,
Transformation file for Text and Attribute load:
For (ID=0CO_AREA+*STR(_)+ID) --> created 1130_1000142 as a member in dimension.
Now in BW in the hierarchial view, Node Name appears like 1130000001000142
In the Transformation file for Hierarchy:
NODENAME=NODENAME (since in the BW the node name shows the controlling area in as 1130000001000142 )
In the conversion file using a JavaScript i want to split as follows
External Internal
1130000001000142 1130_1000142
Is my understanding right or there is some other way to deal with this.
Regards,
Hello Vadim,
Based on the character length the leading positions get appended with Zero. But the issue is that the character length is 7 or 8..
When I tried to test by having the logic of Controlling area + ID without "_" and selecting external Format in the data Manager package i could load both the text and hierarchy with out any issues.
Regards,
Hello Vadim,
I am facing some issue for Parents which have text in because of the parselnt in the js script.
So I tried to write an if-else Statement around this to handle Not a number.
js:if(isNaN(%external%)) then %external%.toString().substring(0,4)+"_"+%external%.toString().substring(4);%external%.toString().substring(0,4)+"_"+parseInt(%external%.toString().substring(4)).toString()
It gives an Evaluation error .
Regards,
Hello Vadim,
I tried the following apart from yours:
*if(isNaN(%external%)) then(js:%external%.toString().substring(0,4)
+"_"+ %external%.substring(4))
else(js:%external%.toString().substring(0,4) +"_"+
parseInt(%external%.substring(4)))
But does not work. The above goes for Memory dump.
Regards,
P.S. Just tested the following code in the online Java Script editor/debugger:
var s="111100000123456A"
alert(isNaN(s) ? s.toString().substring(0,4)+"_"+s.toString().substring(4) : s.toString().substring(0,4)+"_"+parseInt(s.toString().substring(4)).toString())
Result: 1111_00000123456A
With:
var s="111100000123456"
Result: 1111_123456
Vadim
User | Count |
---|---|
14 | |
4 | |
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.