Unable to get the data with Multiple ID in the rule

Hi Team,

I was unable to get the data with the below condition that passing one ID should get CaseID: 1234 and passing more than one than one ID should get CaseID: Multiple ID

a!localVariables(
local!data: a!queryEntity(
entity: cons!BEMS_ENTITY_PAYABLE_CASE_VIEW,
query: a!query(
aggregation: a!queryAggregation(
a!queryAggregationColumn(field: "clientName", isGrouping: true)
),
filter: a!queryFilter(
field: "caseId",
operator: "in",
value: a!flatten({ ri!caseIds })
),
pagingInfo: rule!TCO_defaultPagingInfo()
)
),
{
if(
local!data.totalCount > 0,
if(
local!data.totalCount = 1,
left(
"Standard Template - " & proper(
joinarray(local!data.data.clientName, " & ")
) & " - " & "CaseId:" & joinarray(ri!caseIds, ", "),
80
),
if(
local!data.totalCount >= 2,
left(
"Standard Template - " & proper(
joinarray(local!data.data.clientName, " & ")
) & " - " & "Multiple Case Id ",
80
),
{}
)
),
{}
)
}
)

  Discussion posts and replies are publicly visible