Combine 2 list into 1 with all the attributes

Certified Associate Developer

Hello guys,

i am trying to combine my list of contract numbers with contract line attributes, where a contract line can have multiple lines.

So for example my list of contracts (local!contracts) contains attribute like name, id, etc...

The contract line items (local!contractlines) contains different attributes of a contract like chargetype,currency,lineId, amount, etc... If there will be only 1 line of contract i can easily achieve the required output using a!forEach like this:

local!finaloutput: a!foreach(

                           items: local!contracts,

                           expression: {

                          {

                           contractName: fv!item.contractName,,

                           lineId: local!contractlines.lineId,

                           chargeType: local!contractlines.chargeType,

                           currency: local!contractlines.currency,

                           amount: local!contractlines.amount

                           }

                           }

Its providing the expected output only in case local!contractlines has just 1 line (1row). In case there are more rows the 2nd.3rd,etc.... are not taken under consideration. So if there are 2 contracts and 2 rows of line items the expected output will contain 4 items (4 rows) where the contrac number1 will have all the attributes of row1 and then row2 and then the same applies for contract number 2.

Thanks for any suggestions

                

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data