a!localVariables( local!reassigndetail: a!queryEntity( entity: cons!MPPCONSDSE_MPPTABSAM_task, query: a!query( selection: a!querySelection( columns: { a!queryColumn( field: "ReassignEmail" ), a!queryColumn( field: "samaccid" ) } ), logicalExpression: a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: "Reassign", operator: "=", value: "Yes" ), a!queryFilter( field: "annoucncementid", operator: "=", value: ri!Announcementid ) }, ignoreFiltersWithEmptyValues: true ), pagingInfo: a!pagingInfo( startIndex: 1, batchSize: -1 ) ), fetchTotalCount: false ).data, local!fabdetails: a!forEach( items:local!reassigndetail, expression:rule!MPPER_getFabsnamefromsamaccid(fv!item.samaccid) ), local!fabdetails2: a!forEach(a!flatten( local!fabdetails).fabname,fv!item), local!samemails: a!forEach(a!flatten( local!reassigndetail).ReassignEmail,fv!item) , local!samdata : a!queryEntity( entity: cons!MPPCONSCDT_SAMAccountability, query: a!query( logicalExpression: a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: "samemail", operator: "in", value:local!samemails ), a!queryFilter( field: "fabname", operator: "in", value:local!fabdetails2 ) }, ignoreFiltersWithEmptyValues: true ), pagingInfo: a!pagingInfo( startIndex: 1, batchSize: 50 ) ), fetchTotalCount: false ).data, local!result: a!forEach( items:local!samdata, expression: cast(typeof('type!{urn:com:appian:types}MPPSAMAccoumtability'()),fv!item) ), local!result )
this works fine if local!reassigndetail finds some data from DB using a!queryentity but when it doesn't return any data from db then it gives following error
Expression evaluation error at function a!forEach [line 47]: Invalid index: Cannot index property ’’fabname’’ of type String into type List of Variant
Please help
Discussion posts and replies are publicly visible
Your code is unnecessarily difficult to read when pasted straight into your post as plaintext as all formatting and indentation is lost. I would encourage you to edit your post and insert it instead into a Code Box ("Insert" --> "Insert Code" in the editor menu) so it's actually manageable.
Done
That's better - though it might be good to copy the code out of Appian again since the code you posted still doesn't have indentation (making it still pretty hard to read).
done