Skip to main content
New Participant
Feb 11, 2025 4:56 PM UTC
Question

Unable to get the data with multiple ID's

Hi Team,

I was using the below rule and trying to fetch the data with the condition that selecting one ID from a grid should get one CaseID: 50324 and if selecting more than one ID should get CaseID: Multiple ID. can anyone please help me on this 

a!localVariables(
local!data: a!queryEntity(
entity: cons!BEMS_ENTITY_PAYABLE_CASE_VIEW,
query: a!query(
/*selection: a!querySelection(a!queryColumn(field: "clientName")),*/
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
),
{}
)
),
{}
)
}
)

7 replies

stefanhelzle0001
Brainy
Feb 11, 2025 6:53 PM UTC

It seems like your rule input is just a single integer. Make it a list and this should work.

The a!flatten and the curly brackets in line 12 are not necessary.

New Participant
Feb 12, 2025 5:13 AM UTC

In the below code on the if condition that no value is passing in the ri!caseIds i mean 0 then i should get null value but iam not getting anything.

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

konduruc733182
Inspiring
Feb 12, 2025 5:21 AM UTC

You can make use of the defaultValue() for the totalCount in case of no caseIds

Participating Frequently
Feb 12, 2025 5:35 AM UTC

Hi [mention:9684f2a1b2d2427fbc85a4776fe2be35:e9ed411860ed4f2ba0265705b8793d05] 

Change the rule input as a list and it will work.

No need for a!flatten and curly brackets in line number 12.