on 12-09-2009 1:22 PM
I have the following problem.
Source structure:
<header>
<segment>
<value1>A</value1>
<value2>B</value2>
</segment>
<segment>
<value1>C</value1>
<value2>D</value2>
<segment/>
<segment>
<value1>E</value1>
<value2>F</value2>
<segment/>
</header>
If the field value1 concatenated with value2 is equal to CD somewhere in the source structure then I want to produce the following target.
<header>
<indicator>X</indicator>
</header>
If the source structure value fileds concatenated is equal to XY then the following target.
<header>
<indicator>B</indicator>
</header>
Otherwise the following target.
<header>
<indicator/>
</header>
How would I solve this with a gra
Hi,
In place of UDF you can also use conversion function FixValues.
By passing concatenated value as key and required value in value column it can be done easily.
Example: CD as key and X in value column.
Keep the default value as space to generate the target.
Thanks and regards,
Sandeep Jaiswal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
value - 1 map with default
value - 2 map with default concatenate --> equalS (CD) --->ifWithOutElse --> Then ---> map a constant 'X' to target field.
Here value1 and value2 should be in the same context.
Regards
Ramesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is a very simple logic..
Concatenate (Value1 & 2) --> equalS (CD) --->ifWithOutElse --> Then ---> map a constant 'X' to target field.
same logic for XY.
Regards,
Sarvesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I guess it is context issue. Try using RemoveContext just before you map your result to target field. e.g
(Value1 + Value2 ) --> ifWithoutElse --Then (map 'X') --->RemoveContext -->Target field.
You can try the solution given by Sandeep which is good and by using that you can avide some std function e.g. ifWithoutElse, constant, equalS.
Regards,
Sarvesh
Hi
value - 1 map with default
value - 2 map with default concatenate --> equalS (CD) --->ifWithOutElse --> Then ---> map a constant 'X' to target field.
Here value1 and value2 should be in the same context (context point to the header node)
we used mapwith default because if suppose value1 come and value2 not came then it sends the default ("") value other wise it takes the second segment in value2.
Regards
Ramesh
Hi Kalle,
Check this link
http://www.flickr.com/photos/42898709@N07/4171694825/
Here PARVW = value1, PFACH = value2 and target = FromName
I have checked this, its working fine.
If target element comes multiple then use split by value other wise you can delete.
Here i used the map with default value, bcz if some times the field value not come then it takes the default value otherwise take some wrong value.
Regards
Ramesh
its better to write a UDF just for checking the condition instead of going for the if else of graphical mapping
jsut pass the value of the concat function to the UDF and in the UDF put a condition
String a =" ";
if( value.equals("CD"))
{
return X;
}
else if (value.equals("XY"))
{
return B;
}
else
{
return a;
}
HTH
Rajesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.