cancel
Showing results for 
Search instead for 
Did you mean: 

xi mapping issue

Former Member
0 Kudos

<Header>

<Id dt:dt="i4">270</Id>

<Time dt:dt="dateTime">2008-03-19T08:54:26</Time>

<Node1>

<Amt dt:dt="fixed.14.4">20</Amt>

<IsPIO dt:dt="ui1">1</IsPIO>

<Node3>

<IsOut dt:dt="ui1">1</IsOut>

</Node3>

</Node1>

</Header>

<Header>

<Id dt:dt="i4">272</Id>

<Time dt:dt="dateTime">2008-03-19T09:14:15</Time>

<Node1>

<Amt dt:dt="fixed.14.4">80</Amt>

<IsPIO dt:dt="ui1">1</IsPIO>

<Node3>

<IsOut dt:dt="ui1">1</IsOut>

</Node3>

</Node1>

</Header>

<Header>

<Id dt:dt="i4">271</Id>

<Time dt:dt="dateTime">2008-03-19T08:57:28</Time>

<Node1>

<Amt dt:dt="fixed.14.4">-20</Amt>

<IsPIO dt:dt="ui1">1</IsPIO>

<Node2>

<VTran dt:dt="i4">270</VTran>

</Node2>

<Node3>

<IsOut dt:dt="ui1">1</IsOut>

</Node3>

</Node1>

</Header>

From the above strucutre if Id = NOde2-VTran then SUPPRESS the Header where id = Node2-Vtran else populate Header.

Above is the requirement, could any one help with the UDF code to acheive this. Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

GabrielSagaya
Active Contributor
0 Kudos

assume vtran contain 270

function myudf(String a[], ResultList result,Container container)

{

for(int i=0;i<a.length;i++)

if(!a<i>.equals("270"))

result.addValues(a<i>)

else

result.addSuppress;

}

Normally you have to Java Mapping which includes DOM Parser that identifies each and every element.

Find the node2 element and vtran element and suppress the node by using

node2.addSuppress;

then Call this java mapping in UDF by using imports. and proceed.

Answers (2)

Answers (2)

sunil_singh13
Active Contributor
0 Kudos

Hi Souvik,

Well i dont think you really require UDF for that. It can be Implemented using Graphical mapping also .

Id -> equals -> NOde2-VTran->not->ifWithoutElse(Keeps=True )

in the second input of ifWithoutelse give the name of field to be send .

in above case if value is if NOde2-VTran it will give SUPPRESS

as in Property of ifWithoutElse we have given Keeps=true, Which means if Condition is false it will pass SUPPRESS

and if it is true then it will pass the field as it is

UDF

for(int i=0 ;i < input.length;i++)

{

if(input.equals("NOde2-VTran"))

resul.addValue(ResultList.SUPPRESS);

else

resul.addValue(input<i>);

}

Reward Points if Helpful

Thanks

Sunil Singh

Former Member
0 Kudos

Hi,

I think u can do this by using Standard functions only u don't required any UDF try this.

1) VTran(From Node2)>SplitByValue>CollapseContext(Node Function)-->Check for blank("") value by using Equals(Text function) and constant containing value ""(blank)

2) use IfWithOutElse function 1st input for it is output of Equals function

3) 2nd input is Constant containing blank value.

4) right click on IfWithOutElse function sset keeps property TRUE.

try this

Regards,

Rohit

Reward points if helpful.