cancel
Showing results for 
Search instead for 
Did you mean: 

how to giving count increment in mappin?

former_member270261
Participant
0 Kudos

Hi Experts,

could please give suggestion for me to creating the mapping.below requirement.

when ever first unique value in the context it should increment  value is =10, and the duplicate values(repeted values) increment by 900001,900002.

in the context can any one pls help me how to reslove this issue.

Thanks

Narendra

Accepted Solutions (0)

Answers (3)

Answers (3)

RaghuVamseedhar
Active Contributor
0 Kudos

Narendra,

Please create "All values of a Context" UDF. If required use removeContext


public void udf_getCount(String[] Id, ResultList Record_out, Container container) throws StreamTransformationException {

String previous = "--";

int value = 900001;

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

  if (previous.equals(Id[i])) {

   Record_out.addValue(value++);

  } else {

   Record_out.addValue(Id[i]);

  }

  previous = Id[i];

}

}

former_member237514
Participant
0 Kudos

Hi narendran

,

Is it possible to share input and output fields structure screen shot..

former_member270261
Participant
0 Kudos

Hi Raghu,

Thanks for the replay.below output expected for target side.

LINE ITEM is the target field

former_member182412
Active Contributor
0 Kudos

Hi Narendran,

I adjusted the code from raghu, you can use below UDF.


public void udf_getCount(String[] Id, ResultList Record_out, Container container) throws StreamTransformationException {

  String previous = "--";

  int secondValue = 900001;

  int firstValue = 0;

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

  if (previous.equals(Id[i])) {

  Record_out.addValue(secondValue++);

  } else {

  Record_out.addValue(firstValue += 10);

  }

  previous = Id[i];

  }

  }

Regards,

Praveen.

anupam_ghosh2
Active Contributor
0 Kudos

Hi Narendran,

                   Can you please provide some sample input/output to understand your requirement.

Regards

Anupam

former_member270261
Participant
0 Kudos

Hi Anupam,

below out put expected from target side.please help me for suggestions.

unique value  =10

duplicate value=900001

duplicate value=900002

duplicate value=900003

unique value  =20

duplicate value=900004

duplicate value=900005

duplicate value=900006

unique value  =30

duplicate value=900007

duplicate value=900008

Thanks

Narendra

AlexanderApel
Participant
0 Kudos

Hi Narendra,


please send me an Input Example for this output.


regards,

Alex

former_member270261
Participant
0 Kudos

Hi  alex,

meterial is input field

line iteam is output field

below the screen shot kindly check.

Thanks

Narendra

AlexanderApel
Participant
0 Kudos

Hi Narendra,

ok, than you have to check the Occurs from line item and Material in your data type.

Ater that you can use node funktion "exists" and "createif" in your mapping.

regards,

Alex

former_member213558
Active Participant
0 Kudos

can you share your input/output xml structure to give the mapping logic?

former_member270261
Participant
0 Kudos

Hi Alex,

occurence is unbounded imported the external defenation.

exists and create if not creating expected output

Thanks

Narendra

former_member270261
Participant
0 Kudos

Hi ramesh,

input and xml dont have,this is new development,dont have  output xml dont have but  ihave shared above screenshot

plsee

Thanks

Narendra

AlexanderApel
Participant
0 Kudos

can you post your mapping?

former_member213558
Active Participant
0 Kudos

try to create your source/target structure in your ESR and share the same for the mapping, else you can try what  Alexander suggested.

iaki_vila
Active Contributor
0 Kudos

Hi Narendran,

You can use the count function, check this wiki: Count of Records - &amp;#39;Count on the easiest way through&amp;#39; - Process Integration - SCN Wi...

If you want to increment a counter between different mapping, you would need more development: Count of Records - &amp;#39;Count on the easiest way through&amp;#39; - Process Integration - SCN Wi...

Regards.