cancel
Showing results for 
Search instead for 
Did you mean: 

Issue in mapping a peculiar requirement

Former Member
0 Kudos

Dear Gurus,

I have the below requirement -

Source side I have a segment S1 which has cardinality 0 to 99 , I have a field f1 under S1 and I have a segment S2 under S1 which has cardinality 0 to 999 and under S2 segment I have field f2 . In the target side I have a segment T1 which has cardinality 0 to unbounded and under T1 i have the field f3 . I have to concatenate and map all the corresponding values of f2 to target field f3 when f1 has value "001" .

The permissible input file -

S1

-- f1=005

--S2

--f2=abcd

--S2

--f2=efgh

S1

-- f1=001

--S2

--f2=1234

--S2

--f2=5678

S1

-- f1=006

--S2

--f2=ijkl

--S2

--f2=mnop

Permissible Output file -

T1

--f3=12345678

i.e. Here the target field f3 should have the value "12345678" .

Here my key concern is how can we identify the S2's f2 values that corresponds to f1=001 of S1 segment ?

Could anyone help me out in this issue

Thanks & Regards,

Sarat

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks Ravi and Suraj for your timely help .

Regards,

Sarat

Former Member
0 Kudos

Hi,

A small input from my side . The context of F1 should be set to it's parent's parent so that the condition check will happen against all the values of F1 , else , only the 1st value of F1 is checked against the condition .

Regards,

Sarat

former_member181962
Active Contributor
0 Kudos

Hi sarat,

This can be achieved using a combination of graphical mapping and a UDF.

YOu can try the following

F1   ----------
                     \  Equals--------
001(Constant)                        \ Ifwithoutelse -> UDF Concatenate - > Output
                                 F2

Here, F2 must have the context of S1

Concaenating Let me know if you need the cde to concatenate the values of the same queue

Regards,

Ravi

Former Member
0 Kudos

Hi ravi,

Thanks for the reply but here the catch is that I want to concatenate all the values of F2 from segment S2 whose S1 segment's F1 value is 001 . But in the solution that you provided after checking the condition you are passing all the values of F2 to the UDF but I require only corresponding F2 values .

Regards,

Sarat

Former Member
0 Kudos

Hi Ravi ,

A small correction in the input file -

The permissible input file -

S1

-- f1=005

--S2

--f2=abcd

--S2

--f2=efgh

S1

-- f1=001

--S2

--f2=1234

--S2

--f2=5678

S1

-- f1=006

--S2

--f2=ijkl

--S2

--f2=mnop

Permissible Output file -

T1

--f3=12345678

Regards,

Sarat

former_member187339
Active Contributor
0 Kudos

Hi Sarat

try this


F1   ----------
                     \  Equals--------
001(Constant)                                   \ Ifwithoutelse ->Output
        F2 (context S1)--CONCAT UDF-

UDF Code : Advanced udf on queue


String output = "
for (i=0;i<input.length;i++)
	output += input<i>;

result.addValue(output);

Regards

Suraj