cancel
Showing results for 
Search instead for 
Did you mean: 

help required in Idoc mapping!!

Former Member
0 Kudos

Hi,

I have an idoc to file scenario:

Idoc looks like this

Idoc

Header

E1BPE1WLMV (0.....999)

field1

E1BPE1MALG (0.....999)

field2

Target

Details

field3

My requirement is that :

field 3 should b mapped to only the first occurence of field1. (and not the subsequent occurences).

Please suggest how can i proceed ?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks guys...but I have got some more inputs for my requirement now:

Source:

Idoc

Header

E1BPE1WLMV (0.....999)

field1

E1BPE1MALG (0.....999)

field2

Target:

Details

field3 (= field1)

field4 (=field2)

The Details should be created for unique combination of field1 and field 2. For e.g.

Field 1 comes 2,3,4

Field 2 comes 1,5

Then detail should be created 6 times for

field1= 2 & field2= 1

field1= 2 & field2= 5

field1= 3 & field2= 1

field1= 3 & field2= 5

field1= 4 & field2= 1

field1= 4 & field2= 5

Could you please help ?

Edited by: jayagupta21 on Apr 14, 2011 7:24 AM

Former Member
0 Kudos

Hi Experts,

Any solution ?

RKothari
Contributor
0 Kudos

Try the below UDF code:

int i,j;
for(i=0;i<field1.length;i++)
{
	for(j=0;j<field2.length;j++)
	{
		if (!(field1<i>.equals(field2[j])))
		{
			result.addValue("");
		}
	}
}

Former Member
0 Kudos

Hi,

U have to write an UDF for the same. It will be very easy to implement the logic by writing an UDF.

Need to Create an UDF of type All values of Queue.

Have four arguements as follows:

field1-> removeContext() -> UDF arguement1

field2-> removeContext() -> UDF arguement2

field1 -> count -> removeContext -> UDF arguement3

field2 -> count -> removeContext -> UDF arguement4

Inside UDF,

int counter1 = var3.length; // gives the number of field1 items in the incoming Idoc

int counter2 = var4.length; // gives the number of field2 items in the incoming Idoc

Use a for loop and apply ur logic.

The values get stored in the form of arrays and you need to check them and apply your logic.

Cheers,

Souvik

Former Member
0 Kudos

Execution type:All values of a context

String a=" ";

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

{

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

{

a =var1[ i ] + var2[ j ]; (put i and j in square brackets)

result.addValue(a);

}

}

field1

-


udf---removeContextsort(numerical)splitByValue(Value change)-collapseContext-Target

filed2

Former Member
0 Kudos

Thanks Rahul and Souvik.

Rahul:

I am getting the following error while excuting your code:

the length 1 of the array 'sortedFunctionKeys' is not equal to the number 2 of functions

Edited by: jayagupta21 on Apr 14, 2011 8:47 AM

Edited by: jayagupta21 on Apr 14, 2011 8:48 AM

Former Member
0 Kudos

Souvik,

Can you please provide the code for your approach ?

Former Member
0 Kudos

Thanks Amit but i am getting the error while executing your code..please help !!

Former Member
0 Kudos

Try this:

Put execution type as: All values of a queue

String a="";

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

{

for(int j=0;j<var2.length;j++)

{

a= var1[ i ]+var2[j]; (put i in square brackets)

result.addValue(a);

}

}

Former Member
0 Kudos

Amit, Still the same problem

Former Member
0 Kudos

what exception u r getting becoz i am executing this code and its perfectly working fine for me???

Former Member
0 Kudos

the length 1 of the array 'sortedFunctionKeys' is not equal to the number 2 of functions

RKothari
Contributor
0 Kudos

Please check if your UDF is visible under Function & Java Areas section. If not please add the same.

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

Use copyValue to achieve your requirement


field1 -> copyValue:0 -> field3

Hope this helps,

Mark

Former Member
0 Kudos

Use Field 1--> Remove context --> Collapse Context --> Field 3.

If this doesnt solve your issue, please provide source payload & required target payload.

-Gouri