Search code examples
oracleoracle-data-integrator

How could i order expression by getcollist() method in LKM ODI12c (oracle data integrator)


In LKM, I used <%=odiRef.getTargetColList("\n", "[COL_NAME]", ",\n", "\n")%> expression to get target columns but the order of columns names is as source table. for example:

Source table columns: Name, Surname, Age
Target table columns: Surname, Name, Age

LKM: <%=odiRef.getTargetColList("\n", "[COL_NAME]", ",\n", "\n")%>

---> Name, Surname, Age

Desired output

---->Surname, Name, Age

How can i get target columns in order of target table ( Surname, Name, Age)

Thx.


Solution

  • You need to understand the next points:

    • When you use any odiRef expression in a LKM, it will generate the columns/structures as in source, because LKM works over source;
    • When you use any odiRef expression in a IKM, it can generate the columns/structures as in source or as in target;

    Maibe you understood better the two points above, through the next picture: enter image description here

    For your problem you could do the next:

    • in the IKM Mapping Begin declare the <%=odiRef.getTargetColList("\n", "[COL_NAME]", ",\n", "\n")%>;
    • in LKM (any section but no Mapping Begin) use the variable declared in IKM.

    So, in other words, you could generate that columns in IKM and then use it in LKM.

    This can be done because the execution order is the next:

    • All the KM's have sections: Mapping Begin, Execution Unit Begin, Execution Unit Main, Exection Unit End, Mapping End;
    • Each of this section is executed in the next order: Mapping Begin from LKM then Mapping Begin from IKM then Execution Unit Begin from LKM then Mapping Begin from IKM and so on.
    • the last section of each KM - Mapping Cleanup - is executed as above, but only if Mapping > Physical > Check "Remove Temporary Objects on Error"