cancel
Showing results for 
Search instead for 
Did you mean: 

mapping problem due to occurrences

GabrielSagaya
Active Contributor
0 Kudos

Hi all

I Have the Structure like this.

Source Structure

HOS_RSP(0..Unbounded)

|__ LINE (1..Unbounded)

Target Structure

IT_FIRST

|__ ITEM (0..Unbounded)

|__ Line (0..1)

IT_SECOND

|__ ITEM (0..Unbounded)

|__ Line (0..1)

The Input data is

<HOS_RSP>

<LIN>First Line</LIN>

<LIN>First Line</LIN>

<LIN /><LIN /><LIN /> <LIN /> <LIN /> <LIN />

<LIN /> <LIN /> <LIN /><LIN /> <LIN /> <LIN />

<LIN /> <LIN /> <LIN /> <LIN /> <LIN /> <LIN />

<LIN /> <LIN /> <LIN /> <LIN /> <LIN /> <LIN />

<LIN /> <LIN /> <LIN /> <LIN />

</HOS_RSP>

<HOS_RSP>

<LIN>First Line</LIN>

<LIN>First Line</LIN>

<LIN /><LIN /><LIN /> <LIN /> <LIN /> <LIN />

<LIN /> <LIN /> <LIN /><LIN /> <LIN /> <LIN />

<LIN /> <LIN /> <LIN /> <LIN /> <LIN /> <LIN />

<LIN /> <LIN /> <LIN /> <LIN /> <LIN /> <LIN />

<LIN /> <LIN /> <LIN /> <LIN />

</HOS_RSP>

I want populate First 30 records from HOS_RSP to IT_FIRST table and next Second 30 Records from HOS_RSP to IT_SECOND table.How do I populate the value?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

Create a UDF context of <HOS_RSP>

for int i=0;i<=30;i++ pass it to IT_First

another UDF and same concept

int i=30;i<Lin.length;i++ and pass the value to IT_Second

Thanks

Gaurav

GabrielSagaya
Active Contributor
0 Kudos

Thanks for your reply.

I have 2 HOS_RSP Node each contains 30 LINE items that should be populated into LINE item under ITEM Node under IT_FIRST as well as IT_SECOND node.

pleas give me the suggestion??

Former Member
0 Kudos

Hi

Enhance the above code

Create a UDF context of parent of <HOS_RSP>

first loop at int i=0;i<HOS_RSP.length;i++

inner loop for int j=0;j<=30;j++ pass

it to IT_First

Similarly

another UDF and same concept

first loop using <HOS_RSP> and inner

int i=30;i<Lin.length;i++ and pass the value to IT_Second

This will read number of times <HOS_RSP> occur and for every time it occur its first 30 elements will be returned that you can map to IT_First. Similarly the second UDF.

Thanks

Gaurav

Answers (4)

Answers (4)

Former Member
0 Kudos

hi,

you can able do this using standard functions itself.

HOS_RSP(Index(properties select count entire document)(static function))(less(arithmatic func.)--

constant(31)

-map to(create if)|__ ITEM

|__ LINE to|__ LINE

it will give the less than 30 values.

HOS_RSP(Index(properties select count entire document)(static function))(grater(arithmatic func.)--

constant(31)

HOS_RSP(Index(properties select count entire document)(static function))(less(arithmatic func.)--

constant(61)

-map to(and (boolean function))-(create if)--|__ ITEM

|__ LINE to|__ LINE

it will give the 31-60 values.

Regards,

Prakasu

Former Member
0 Kudos

Hi,

if this shud be your output


IT_FIRST
-->I_ITEM(30 times)
----->I_LINE
          1
-->I_ITEM
----->I_LINE
          2

IT_SECOND
-->I_ITEM(30 times)
----->I_LINE
          1
-->I_ITEM
----->I_LINE
          2

then the below mapping works


line--->check--->equalsS--\---------->createif-->I_ITEM
              constant[1]---/

line-->SplitByValue(Each value)-->I_LINE


line--->check--->equalsS--\---------->createif-->I_ITEM
             constant[0]---/

line-->SplitByValue(Each value)-->I_LINE


public void check(String[] a,ResultList result,Container container)
 for(int i = 0 ;i <= 59; i++)
     {
      if(i <= 29)
          {result.addValue("1");}
      else
          {result.addValue("0");}
    }

Edited by: malini balasubramaniam on Oct 23, 2008 9:30 AM

Former Member
0 Kudos

Hi,

You can do this mapping only for parent nodes like IT_First and IT_Second. For child element do 1 to 1 mapping.

Put the context of <LINE> to <HOS_RSP> (Parent node).

use following UDF,

UDF requires 2 input values

1) <LINE>

2) Constant value(depending upo IT_First and IT_Second)

For IT_First, Constant value = 0

For IT_Second, Constant value = 1

int cnt = 0;
for(int i = 0;i< line.length;i++)
{
	if((!line<i>.equals(resultList.CC)) and (cnt = Integer.parseInt(valueCheck[0])))
	{
		
		result.addValue(line<i>);
		
	}
	else
	{
		result.addSuppress();
	}
	if(line<i>.equals(ResultList.CC))
	{
		cnt++;
	}
}

Regards,

Rohit.

Former Member
0 Kudos

I Have the Structure like this.

Source Structure

HOS_RSP(0..Unbounded)

|__ LINE (1..Unbounded)

Target Structure

IT_FIRST

|__ ITEM (0..Unbounded)

|__ Line (0..1)

IT_SECOND

|__ ITEM (0..Unbounded)

|__ Line (0..1)

copy ( LINE , Line ) //first param from Source HOS_RSP, second from Target under IT_FIRST

{

loop thr LINE till u get the context change. Once you get CC, break the loop..

resutList.add( ); //add the element

resultList.add (); //add the context change

}

Map,

LINE(from HOS_RSP) --> UDF --> Line (from IT_FIRST)

GabrielSagaya
Active Contributor
0 Kudos

thanks for your reply

But this is my input

<HOS_RSP>

<LINE>1</LINE>

<LINE>2</LINE>

<LINE>4</LINE>

</HOS_RSP>

<HOS_RSP>

<LINE>6</LINE>

<LINE>7</LINE>

<LINE>8</LINE>

</HOS_RSP>

Here I am able to populate First set Values from LINE Items under HOS_RSP to IT_FIRST table.

But I want to populate second set of Values from LINE Items under HOS_RSP to IT_SECOND table.

Please suggest me??