getting error please help

Code:

a!forEach(pv!addedResearchItems_cdt,
 if(
and(rule!APN_isBlank(index(fv!item,"id",{})),rule!APN_isBlank(fv!item.url)),

cast('type!{urn:com:appian:types:gngp}GNGP_RESEARCH_ITEM',updatecdt(fv!item,{file_name:
if(not(isnull(fv!item.file_name)),
fv!item.file_name,
if(not(isnull(fv!item.document_id)),document(todocument(fv!item.document_id), "name") & "." & document(todocument(fv!item.document_id), "extension"),{})
   )})),
 
  fv!item
))

Getting below error:

(Expression evaluation error at function a!forEach: Error in a!forEach() expression during iteration 1: Expression evaluation error at function 'updatecdt' [line 5]: Length of input arrays must equal length of CDT/Dictionary array) (Data Outputs)

Please help to rectify the above error as what code changes needs to be done

  Discussion posts and replies are publicly visible

Parents
  • Try this

    a!forEach(
      pv!addedResearchItems_cdt,
      if(
        and(
          rule!APN_isBlank(index(fv!item, "id", {})),
          rule!APN_isBlank(fv!item.url)
        ),
        cast(
          'type!{urn:com:appian:types:gngp}GNGP_RESEARCH_ITEM',
          a!update(
            fv!item,
            { "file_name" },
            {
              if(
                not(isnull(fv!item.file_name)),
                fv!item.file_name,
                if(
                  not(isnull(fv!item.document_id)),
                  document(todocument(fv!item.document_id), "name") & "." & document(
                    todocument(fv!item.document_id),
                    "extension"
                  ),
                  {}
                )
              )
            }
          )
        ),
        fv!item
      )
    )

Reply
  • Try this

    a!forEach(
      pv!addedResearchItems_cdt,
      if(
        and(
          rule!APN_isBlank(index(fv!item, "id", {})),
          rule!APN_isBlank(fv!item.url)
        ),
        cast(
          'type!{urn:com:appian:types:gngp}GNGP_RESEARCH_ITEM',
          a!update(
            fv!item,
            { "file_name" },
            {
              if(
                not(isnull(fv!item.file_name)),
                fv!item.file_name,
                if(
                  not(isnull(fv!item.document_id)),
                  document(todocument(fv!item.document_id), "name") & "." & document(
                    todocument(fv!item.document_id),
                    "extension"
                  ),
                  {}
                )
              )
            }
          )
        ),
        fv!item
      )
    )

Children