if else customise

if(
  ri!actionTypeId_int = cons!CR_CREDIT_ACTION_TYPE_IDS[1],
  rule!CR_APP_CA_PDF_genericRuleForNtb(
    cif_int: ri!cif_int,
    requestId_int: ri!requestId_int,
    duRequestId_int: ri!duRequestId_int
  ),
  if(
    ri!actionTypeId_int = cons!CR_CREDIT_ACTION_TYPE_IDS[11],
    rule!CR_APP_CA_PDF_genericRuleForContractExtension(
      cif_int: ri!cif_int,
      requestId_int: ri!requestId_int,
      duRequestId_int: ri!duRequestId_int
    ),
    if(
      ri!actionTypeId_int = cons!CR_CREDIT_ACTION_TYPE_IDS[12],
      rule!CR_APP_CA_PDF_genericRuleForRemedialAndSAMHandoverManagement(
        cif_int: ri!cif_int,
        requestId_int: ri!requestId_int,
        duRequestId_int: ri!duRequestId_int
      ),
      if(
        ri!actionTypeId_int = cons!CR_CREDIT_ACTION_TYPE_IDS[2],
        rule!CR_APP_CA_PDF_genericRuleForCashCollateral(
          cif_int: ri!cif_int,
          requestId_int: ri!requestId_int,
          duRequestId_int: ri!duRequestId_int
        ),
        if(
          ri!actionTypeId_int = cons!CR_CREDIT_ACTION_TYPE_IDS[4],
          rule!CR_APP_CA_PDF_genericRuleForRenewalNoChange(
            cif_int: ri!cif_int,
            requestId_int: ri!requestId_int,
            duRequestId_int: ri!duRequestId_int
          ),
          if(
            ri!actionTypeId_int = cons!CR_CREDIT_ACTION_TYPE_IDS[3],
            rule!CR_APP_CA_PDF_genericRuleForRenewalWithAmendments(
              cif_int: ri!cif_int,
              requestId_int: ri!requestId_int,
              duRequestId_int: ri!duRequestId_int
            ),
            if(
              ri!actionTypeId_int = cons!CR_CREDIT_ACTION_TYPE_IDS[13],
              rule!CR_APP_CA_PDF_genericRuleForAllAmendments(
                cif_int: ri!cif_int,
                requestId_int: ri!requestId_int,
                duRequestId_int: ri!duRequestId_int
              ),
              if(
                ri!actionTypeId_int = cons!CR_CREDIT_ACTION_TYPE_IDS[5],
                rule!CR_APP_CA_PDF_genericRuleForExitBorrowingRelationship(
                  cif_int: ri!cif_int,
                  requestId_int: ri!requestId_int,
                  duRequestId_int: ri!duRequestId_int
                ),
                if(
                  ri!actionTypeId_int = cons!CR_CREDIT_ACTION_TYPE_IDS[9],
                  rule!CR_APP_CA_PDF_genericRuleForCollateralRelatedAmendment(
                    cif_int: ri!cif_int,
                    requestId_int: ri!requestId_int,
                    duRequestId_int: ri!duRequestId_int
                  ),
                  if(
                    ri!actionTypeId_int = cons!CR_CREDIT_ACTION_TYPE_IDS[8],
                    rule!CR_APP_CA_PDF_genericRuleForLimitExtension(
                      cif_int: ri!cif_int,
                      requestId_int: ri!requestId_int,
                      duRequestId_int: ri!duRequestId_int
                    ),
                    if(
                      ri!actionTypeId_int = cons!CR_CREDIT_ACTION_TYPE_IDS[7],
                      rule!CR_APP_CA_PDF_genericRuleForTempIncrease(
                        cif_int: ri!cif_int,
                        requestId_int: ri!requestId_int,
                        duRequestId_int: ri!duRequestId_int
                      ),
                      if(
                        ri!actionTypeId_int = cons!CR_CREDIT_ACTION_TYPE_IDS[6],
                        rule!CR_APP_CA_PDF_genericRuleForRestructureOrReschedule(
                          cif_int: ri!cif_int,
                          requestId_int: ri!requestId_int,
                          duRequestId_int: ri!duRequestId_int
                        ),
                        if(
                          ri!actionTypeId_int = cons!CR_CREDIT_ACTION_TYPE_IDS[14],
                          rule!CR_APP_CA_PDF_genericRuleForDegrouping(
                            cif_int: ri!cif_int,
                            requestId_int: ri!requestId_int,
                            duRequestId_int: ri!duRequestId_int
                          ),
                          if(
                            ri!actionTypeId_int = cons!CR_FI_CREDIT_ACTION_TYPE_IDS[1],
                            rule!CR_APP_CA_PDF_genericRuleForFiNtb(
                              cif_int: ri!cif_int,
                              requestId_int: ri!requestId_int,
                              duRequestId_int: ri!duRequestId_int
                            ),
                            if(
                              ri!actionTypeId_int = cons!CR_FI_CREDIT_ACTION_TYPE_IDS[2],
                              rule!CR_APP_CA_PDF_genericRuleForFiAnnualReview(
                                cif_int: ri!cif_int,
                                requestId_int: ri!requestId_int,
                                duRequestId_int: ri!duRequestId_int
                              ),
                              if(
                                ri!actionTypeId_int = cons!CR_FI_CREDIT_ACTION_TYPE_IDS[3],
                                rule!CR_APP_CA_PDF_genericRuleForFiInterimAmendments(
                                  cif_int: ri!cif_int,
                                  requestId_int: ri!requestId_int,
                                  duRequestId_int: ri!duRequestId_int
                                ),
                                if(
                                  ri!actionTypeId_int = cons!CR_FI_CREDIT_ACTION_TYPE_IDS[4],
                                  rule!CR_APP_CA_PDF_genericRuleForFiExitCancellation(
                                    cif_int: ri!cif_int,
                                    requestId_int: ri!requestId_int,
                                    duRequestId_int: ri!duRequestId_int
                                  ),
                                  if(
                                    ri!actionTypeId_int = cons!CR_CREDIT_ACTION_TYPE_IDS[15],
                                    rule!CR_APP_CA_PDF_genericRuleForRetailParameterizedLending(
                                      cif_int: ri!cif_int,
                                      requestId_int: ri!requestId_int,
                                      duRequestId_int: ri!duRequestId_int
                                    ),
                                    {}
                                  )
                                )
                              )
                            )
                          )
                        )
                      )
                    )
                  )
                )
              )
            )
          )
        )
      )
    )
  )
)

this is if else if else doesn't looking good can we customise this?

  Discussion posts and replies are publicly visible

  • +1
    Certified Senior Developer

    You can consider using a!match() function.
    Documentation

  • +1
    Certified Senior Developer

    Hello ,
    Since you are using a single variable, you can use the a!match(). Below is an example of how you can do it. Your value will be compared to the value that is passed in the equals parameter and will provide the immediate outcome which is defined at then parameter.

     

    a!match(
      value: ri!actionTypeId_int,
      equals: cons!CR_CREDIT_ACTION_TYPE_IDS[1],
      then: rule!CR_APP_CA_PDF_genericRuleForNtb(
        cif_int: ri!cif_int,
        requestId_int: ri!requestId_int,
        duRequestId_int: ri!duRequestId_int
      ),
      equals: cons!CR_CREDIT_ACTION_TYPE_IDS[11],
      then: rule!CR_APP_CA_PDF_genericRuleForContractExtension(
        cif_int: ri!cif_int,
        requestId_int: ri!requestId_int,
        duRequestId_int: ri!duRequestId_int
      ),
      equals: cons!CR_CREDIT_ACTION_TYPE_IDS[12],
      then: rule!CR_APP_CA_PDF_genericRuleForRemedialAndSAMHandoverManagement(
        cif_int: ri!cif_int,
        requestId_int: ri!requestId_int,
        duRequestId_int: ri!duRequestId_int
      ),
      equals: "Conditon 4",
      then: "Output 4",
      equals: "Conditon 5",
      then: "Output 5",
      equals: "Conditon n",
      then: "Output n",
      default: null
    )