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
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 ) )
getting below error
(Expression evaluation error at function a!forEach: Error in a!forEach() expression during iteration 1: Expression evaluation error at function a!update [line 5]: Cannot update GNGP_RESEARCH_ITEM; received 1 keys and 0 values) (Data Outputs)
Make sure code returns a value to update or use a null check beforeif( 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" ), {} ) )