cancel
Showing results for 
Search instead for 
Did you mean: 

Pick first value from source structure out of multiple satisfying condition

Former Member
0 Kudos

Hi PI Experts,

I have mapping situation as follows. Looking for best way to achieve this.

I have source structure

Src Header

Src Line ITems ( 1.. N)

Line Field 1

Src Details records ( 1....N)

Field 1

Field 2

My Target stucture is

Target (1.. N) ( Cardinality same as the Src Details records)

Line Field1

Field 1

Field 2 ( This is should field2 of the first Src detail records which matches the condition based on field 1)

From the source message I want to repeat the field 2 in the target from that source record which matches the condition.

e.g if Field1 = PR00 then Copy of the values of records field 2 in the all the output target records.

I was thinking of useOneOfMany but the issue is my source i can have multiple records which may satisfy the condition but i want only the first one which is satisfying condition from the source records to be output in targe.

Thanks,

Mahesh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

If multiple values satisfies your condition then take all and use copyValue with index 1...

which allows you to copy the first value

Check it out

HTH

Rajesh

Former Member
0 Kudos

this helped solve my problem! thanks.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

Use Collapse Context & SplitByValues like this

Field2collapseContext-SplitByValue---Target Field

Set the context of field to one level Up

Regards