Is it possible to map specific fields from one CDT to another within an expressi

Is it possible to map specific fields from one CDT to another within an expression rule? So far I have been unsuccessful. Code is below - any suggestion would be greatly appreciated!


with(
cacData : rule!CAC_getExceptionByIDAndNotStatus(ri!crsExceptionID, "Cleared"),
crsData: rule!CAC_getCRSExceptionCollateralByActivityIdAndCollateralCode(pv!cacData.activityID, pv!cacData.typecode),

cacData.crsExceptionID : crsData.ActivityId_Int,
cacData.description : crsData.Description_txt,
cacData.exceptionType : crsData.Type_Txt,
cacData.crsStatus : crsData.Status_Txt,
cacData.deadlineDate : crsData.DeadlineDate_Dte,
cacData.addedDate : crsData.AddedDate_Dte,
cacData.descriptionLine1: crsData.Description1_Txt,
cacData.descriptionLine2: crsData.Description2_Txt,
cacData.recordcd : crsData.RecordCd_Txt,
cacData.loanNumber : crsData.LoanNbr_Int,
cacData.customerNumber : toInteger(crsData.Customer_Dec),
cacData.tiedTable : crsData.TiedTable_Txt,
ca...

OriginalPostID-157746

OriginalPostID-157746

  Discussion posts and replies are publicly visible

Parents
  • HI ashleyb

    Yes it can be done.

    But by looking at your code, I would suggest you to pass the variables in to the expression rather than accessing the parent variable with out passing as a parameter. This is the best practice and it give more readability and maintainability to the code.

    Once you have the first two CDTs populated using the rules construct a new CDT using 'type' construct and map the desired value and return the newly created CDT from the expression.

    for ex:

    local!firstCDT : rule!CAC_getExceptionByIDAndNotStatus(ri!crsExceptionID, "Cleared"),
    local!secondCDT : rule!CAC_getCRSExceptionCollateralByActivityIdAndCollateralCode(ri!cacData.activityID, ri!cacData.typecode),
    
    local!returnCDT: 'type!{yourcdtnamespace}yourCDTname'(firstEle : local!firstCDT.ActivityId_Int,secondElement: local!secondCDT.LoanNbr_Int),

    Regards

    Suresh

Reply
  • HI ashleyb

    Yes it can be done.

    But by looking at your code, I would suggest you to pass the variables in to the expression rather than accessing the parent variable with out passing as a parameter. This is the best practice and it give more readability and maintainability to the code.

    Once you have the first two CDTs populated using the rules construct a new CDT using 'type' construct and map the desired value and return the newly created CDT from the expression.

    for ex:

    local!firstCDT : rule!CAC_getExceptionByIDAndNotStatus(ri!crsExceptionID, "Cleared"),
    local!secondCDT : rule!CAC_getCRSExceptionCollateralByActivityIdAndCollateralCode(ri!cacData.activityID, ri!cacData.typecode),
    
    local!returnCDT: 'type!{yourcdtnamespace}yourCDTname'(firstEle : local!firstCDT.ActivityId_Int,secondElement: local!secondCDT.LoanNbr_Int),

    Regards

    Suresh

Children
No Data