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
  • @ashleyb If I understand your question correctly, following snippet resolves your query:

    with(
    \tlocal!cacData : rule!CAC_getExceptionByIDAndNotStatus(ri!crsExceptionID, "Cleared"),
    \tlocal!crsData: rule!CAC_getCRSExceptionCollateralByActivityIdAndCollateralCode(pv!cacData.activityID, pv!cacData.typecode),
    \t
    \t/*Assuming that local!cacData has a single value*/
    \tlocal!newCacData:type!cacData(
    \ tcrsExceptionID:local!cacData.ActivityId_Int,
    \ tdescription: local!crsData.Description_txt,
    \ texceptionType: local!crsData.Type_Txt,
    \ tcrsStatus: local!crsData.Status_Txt,
    \ t... and so on
    \t),
    \t
    \t/*Assuming that local!cacData has multiple values*/
    \tlocal!newCacData:apply(
    \ ttype!cacData(
    \ tcrsExceptionID:,
    \ tdescription: _ ,
    \ texceptionType: _,
    \ tcrsStatus: _,
    \ t... and so on
    \ t),
    \ tmerge(
    \ tlocal!cacData.ActivityId_Int,
    \ tlocal!crsData.Description_txt,
    \ tlocal!crsData.Type_Txt,
    \ tlocal!crsData.Status_Txt
    \ t...and so on
    \ t)
    \t),
    \ttodatasubset(local!newCacData,topgainginfo(1,-1))
    )

    Not sure why there is local as well as process variable for cacData, but you could use the PV as long as you place the above content in the process model directly, else you may pass the PV as an rule input to the rule in which above contents are encapsulated.
Reply
  • @ashleyb If I understand your question correctly, following snippet resolves your query:

    with(
    \tlocal!cacData : rule!CAC_getExceptionByIDAndNotStatus(ri!crsExceptionID, "Cleared"),
    \tlocal!crsData: rule!CAC_getCRSExceptionCollateralByActivityIdAndCollateralCode(pv!cacData.activityID, pv!cacData.typecode),
    \t
    \t/*Assuming that local!cacData has a single value*/
    \tlocal!newCacData:type!cacData(
    \ tcrsExceptionID:local!cacData.ActivityId_Int,
    \ tdescription: local!crsData.Description_txt,
    \ texceptionType: local!crsData.Type_Txt,
    \ tcrsStatus: local!crsData.Status_Txt,
    \ t... and so on
    \t),
    \t
    \t/*Assuming that local!cacData has multiple values*/
    \tlocal!newCacData:apply(
    \ ttype!cacData(
    \ tcrsExceptionID:,
    \ tdescription: _ ,
    \ texceptionType: _,
    \ tcrsStatus: _,
    \ t... and so on
    \ t),
    \ tmerge(
    \ tlocal!cacData.ActivityId_Int,
    \ tlocal!crsData.Description_txt,
    \ tlocal!crsData.Type_Txt,
    \ tlocal!crsData.Status_Txt
    \ t...and so on
    \ t)
    \t),
    \ttodatasubset(local!newCacData,topgainginfo(1,-1))
    )

    Not sure why there is local as well as process variable for cacData, but you could use the PV as long as you place the above content in the process model directly, else you may pass the PV as an rule input to the rule in which above contents are encapsulated.
Children
No Data