How to map CDT

Certified Associate Developer

Hello,

 

I have a requirement where I need to map data in one CDT to another. The two CDT's are as below

 

DS_SeparatedData which includes FieldIdentifier,DataValue,Datacaption and Keyidentifier - These values are coming from database, Now what I want is I want to map the value of FieldIdentifier and DattaValue manually from another variable. So my another variable would be: VD_SeparatedData which includes FieldIdentifier and DataValue. As per the value available in VD_SeparatedData variable, I want to update the value in DS_SeparatedData. for eg:

 Lets say my DS_SeparatedData consists of following value. i.e.

DS_SeparatedData

         FieldIdentifier:"Email"

         DataValue:abc@abc.com

         Datacaption: "Email ID"

        KeyIdentifier:2

 

VD_SeparatedData

       FieldIdentifier:"Email"

       DataValue:pqr@xyz.com

 

So I want DataValue in VD_SeparatedData variable to get updated in DS_SeparatedData as FieldIdentifier is same on both the variable. 

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    Certified Lead Developer
    in reply to viveku3486
    type!B is nothing but, will be used to form a the original variable. Let's say In your case actual cdt in which you want to copy the data, if its name is Employee then you could declare it as follows:


    type!Employee(
    empName: ri!otherCDT.empName,
    email: "abc@test.com",
    identifier: ri!otherCDT.eventIdentifier
    )

    Assume empName, email & identifier are the properties of your Target/Actual CDT where as empName, eventIdentifier is the property of your parameterized CDT which has the value

    Here type!Employee() will prepare a CDT object of type Employee

    Also, if you want to generate array of CDT then you need to make the use of looping functions such as: a!forEach(), apply() etc..


    Hope this will help you.
Children