Skip to main content
February 11, 2025
Question

Unable to get the data with multiple ID's

  • February 11, 2025
  • 7 replies
  • 0 views

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
February 11, 2025

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.

February 12, 2025

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
February 12, 2025

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

February 12, 2025

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.