cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping problem

former_member200267
Participant
0 Kudos

Hi experts,

Could please let me know how to perform mapping for the below explained scenario:

source structute:

B 0..unbounded

field 0..1

Target structure:

Dest 0..1

field1

field2

field3

The B structure has 3 lines ,from each line the field has to be mapped to field1,field2 & field3 respectively

i.e basically we have to loop the struture B and map to Dest.

Please let me know how to do.

Regards,

RDS

Accepted Solutions (1)

Accepted Solutions (1)

former_member200267
Participant
0 Kudos

Hi Milan,

Could you please give me the complete udf code.

Regards,

RDS

Former Member
0 Kudos

Hey,

This is just one line code which i have given in the previous reply.

No more coding is required for this problem.

revert in case of any issue with respect to the code.

reward points if useful.

regards,

Milan

Answers (6)

Answers (6)

former_member200267
Participant
0 Kudos

Hi,

There is no condition

eg: source file

B 10A6

B 10A1 T 2022W

B 10A2 22W

the source structure occurs three times and this has to be mapped to the target structure look as follows

A10A6 10A1 T 2022W 10A2 22W

Regards,

RDS

Edited by: Shankar Raju Devadoss on Jul 16, 2008 1:57 PM

former_member190389
Active Contributor
0 Kudos

Hi,

if the source will always have 3 fields (not unbounded )then the solution said by Milan will work else change you target struct to have 0.. unbounded node..

Former Member
0 Kudos

Hi,

Target is 0..1, so maximum it occurs once,

So if any condition is there based on that we can map, by set the context, otherwise not possible.

Former Member
0 Kudos

Hey,

Write a UDF of Context type.

Pass two parameters String Field, String Constant.

The input to first value will be your source node field.

The input to second value will be a constant(0,1,2)

For first field value in target structure(field1) pass '0'

For second field value in target structure(field2) pass '1'

For third field value in target structure(field) pass '2'

The code will be like this.

result.addValue(Field[Constant[0]]);

reward points if useful.

regards,

Milan

Former Member
0 Kudos

As said by Progirl about condition, you should have 3 different conditon then you can map it otherwise it seems quite difficult to map it.

Former Member
0 Kudos

Hi,

You can directly map 3 target elements to single source element. If any condition then based on condition you can map to single target element.

Thanks,

RamuV

former_member190389
Active Contributor
0 Kudos

Is there any condition on which the mapping has to be peformed