AI Classifier Treating List as a Single Value
Hi Team,
I'm using the Document Classifier to distinguish between Medical Certificates and other document types (e.g., doctor prescriptions, blood reports, etc.). My goal is to extract data only from Medical Certificates after classification.
I am using the AI Classifier Skill, which returns a list of classified documents in the following format: The output of this is a list say : [classifiedItem=325673, type=Medical Certificate, confidenceScore=94, errorMessage=],[classifiedItem=325672, type=Medical Certificate, confidenceScore=95, errorMessage=]
To process the classification result, I wrote the following expression to match each classified document with the corresponding uploaded document and then extract data only from Medical Certificates:
However, I have noticed that even when the classification result contains multiple values, Appian is treating the entire list as one single value, instead of iterating over each item properly. (Screenshot below)

a!localVariables(
local!document : ri!document,
local!classificationResult: a!forEach(
items: ri!AboveThreshold,
expression: a!localVariables(
local!appianDocId: index(
ri!document,
'recordType!RSL Request Document.appianDocId',
null
),
if(
and(a!isNotNullOrEmpty(local!appianDocId) ,
tointeger(fv!item.classifiedItem) = tointeger(local!appianDocId)),
fv!item,
null
)
)
),
local!classificationResult
)
Question: How can I modify my expression rule to correctly process each classified document separately and extract data only from Medical Certificates? Alternatively, is there a better approach to achieve this in Appian?
Here is my process model

