Skip to main content
natarajanm0529
October 31, 2023
Solved

I am getting CastInvalid Error Message . I verified all the datatypes . It looks good. I dont know where this error is pointing.

  • October 31, 2023
  • 8 replies
  • 1 view

Expression evaluation error at function a!forEach [line 104]: Error in a!forEach() expression during iteration 1: Expression evaluation error at function 'cast' [line 106]: Could not cast from COSELM_coselm_eox_information to Number (Integer). Details: CastInvalidCould not cast from COSELM_coselm_eox_information to Number (Integer). Details: CastInvalid

Best answer by stewart.burchell

You don't need the CAST. You can simply have the following:

a!forEach(
    items: local!productInfo,
    expression: 'type!{urn:com:appian:types:COSELM}COSELM_coselm_eox_information'(
      /* map your attributes from each instance of fv!item to your CDT attributes */
    )
  )

8 replies

natarajanm0529
October 31, 2023

I am not sure, How to debug this issue in order to isolate the where the error is originating?

stewart.burchell
October 31, 2023

You don't need the CAST. You can simply have the following:

a!forEach(
    items: local!productInfo,
    expression: 'type!{urn:com:appian:types:COSELM}COSELM_coselm_eox_information'(
      /* map your attributes from each instance of fv!item to your CDT attributes */
    )
  )

natarajanm0529
October 31, 2023

Thank you :). But in my other expression i am doing casting which is working i am not sure why i am getting error. However this solution works fine. Let me integrate this with process model and see if it actually post the data to db 

  a!forEach(
  items: local!productinfo,
  expression: 
  'type!{urn:com:appian:types:COSELM}COSELM_coselm_eox_information'(
    
      serialNumber: fn!index(fv!item, "EOXInputValue", null),
      createdBy: loggedInUser(),
      createdOn: now(),
      modifiedBy: loggedInUser(),
      modifiedOn: now(),
      eOlproductId: fn!index(fv!item, "EOLProductID", null),
      productIdDescription: fn!index(fv!item, "ProductIDDescription", null),
      productBulletinNumber: fn!index(fv!item, "ProductBulletinNumber", null),
      linkToProductBulletinUrl: fn!index(fv!item, "LinkToProductBulletinURL", null),
      eOxExternalAnnouncementDate: fn!index(fv!item, "EOXExternalAnnouncementDate", null),
      endOfSaleDate: fn!index(fv!item, "EndOfSaleDate", null),
      endOfSwMaintenanceReleases: fn!index(fv!item, "EndOfSWMaintenanceReleases", null),
      endOfSecurityVulSupportDate: fn!index(fv!item, "EndOfSecurityVulSupportDate", ""),
      endOfRoutineFailureAnalysisDate: fn!index(fv!item, "EndOfRoutineFailureAnalysisDate", null),
      endOfServiceContractRenewal: fn!index(fv!item, "EndOfServiceContractRenewal", null),
      lastDateOfSupport: fn!index(fv!item, "LastDateOfSupport", null),
      endOfSvcAttachDate: fn!index(fv!item, "EndOfSvcAttachDate", null),
      updatedTimeStamp: fn!index(fv!item, "UpdatedTimeStamp", null),
      pIdActiveFlag: fn!index(fv!item, "PIDActiveFlag", null),
      migrationProductInfoUrl: fn!index(fv!item, "MigrationProductInfoURL", null),
      migrationInformation: fn!index(fv!item, "MigrationInformation", null),
      migrationProductId: fn!index(fv!item, "MigrationProductId", null),
      migrationProductName: fn!index(fv!item, "MigrationProductName", null),
      migrationStrategy: fn!index(fv!item, "MigrationStrategy", null),
      migrationOption: fn!index(fv!item, "MigrationOption", null),
    
  ),

stewart.burchell
October 31, 2023

see my explanation below