Skip to Content
0
Former Member
Oct 27, 2005 at 05:43 PM

Advance user defined function

13 Views

Hi,

I have a user defined function:

<i>public void CheckInitial(String[] a, String[] b, ResultList result, Container container){

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

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

{

result.addValue( "1");

}else {

result.addValue( b<i>);

}

}</i>

Purpose is to pass a constant value to the target element only if a value exists in the previous element.

If the previous element has is not " " then I want pass a 2nd Source element value.

This seems to work for the first queue. It fails for the 2nd Queue. I tried selecting the entire queue in the user defined function.

Here is test Source structures:

<?xml version="1.0" encoding="UTF-8" ?>

- <ns0:Dept_MT xmlns:ns0="urn:oasis">

- <DeptID>

<MngrID>101</MngrID>

<Name>John</Name>

</DeptID>

- <DeptID>

<MngrID />

<Name>Joe</Name>

</DeptID>

- <DeptID>

<MngrID>331</MngrID>

<Name>Martin</Name>

</DeptID>

</ns0:Dept_MT>

Result structure from my test:

<?xml version="1.0" encoding="UTF-8" ?>

- <ns0:Targt_MT xmlns:ns0="urn:oasis">

- <Destdept>

<FuncMang>101</FuncMang>

<Name>1</Name>

</Destdept>

- <Destdept>

<FuncMang />

</Destdept>

- <Destdept>

<FuncMang>331</FuncMang>

</Destdept>

</ns0:Targt_MT>

<Name> tag totally disappears in the 2nd and 3rd structures.

Any idea what's wrong here.