to Number (Integer). Details: CastInvalid) (Data Outputs)

Certified Senior Developer

Hi.  

I am getting an error trying to parse a list of docIds and convert  it to a list of cdts I made.  The cdt are of the form projectMouDocument{mouId(int), docId(int))

I pass in a static mouId and a list of docIds.

Heres my script for the output into a process variable that is a list of projectMouDocuments.  I expect to get a list of projectMou documents from this.

a!forEach(
    pv!documentIds,
    cast(  'type!{urn:com:appian:types}DSC01_projectMouDocuments'(), a!map(  docId: pv!mouId,   mouId: tointeger(fv!item)  )   )
)
Error in script task : An error occurred while evaluating expression: projectMouDocuments:a!forEach(pv!documentIds, cast('type!{urn:com:appian:types}DSC01_projectMouDocuments'(), a!map(docId:pv!mouId, mouId:tointeger(fv!item)))) (Expression evaluation error at function a!forEach: Error in a!forEach() expression during iteration 1: Expression evaluation error at function 'cast': Could not cast from DSC01_projectMouDocuments to Number (Integer). Details: CastInvalidCould not cast from DSC01_projectMouDocuments to Number (Integer). Details: CastInvalid) (Data Outputs)

  Discussion posts and replies are publicly visible

  • 0
    Certified Senior Developer

    Hello  

    Based on the code you shared, it seems you're mapping docId to mouId and then mouId to the current item in documenIds. Is this intentional?

    It's important to ensure that the pv!mouId data type matches the type of value it should hold. For example, if mouId represents a single integer value, then the CDT field should be an integer data type with a single value.

    I'm sharing some code based on my understanding that docId and mouId should be mapped to their respective fields in the CDT.

    a!forEach(
      pv!documentIds,
      'type!{urn:com:appian:types}DSC01_projectMouDocuments'(docId: tointeger(fv!item),   mouId:pv!mouId  )
    )


    let me know if that works for you