Single vs Multiple output from IF expression

Certified Lead Developer
if(
rule!getEmployeeByEmployeeId(ri!employeeId).employeeTypeId = 1,
rule!getFormDataForEmployee(1,2),
{/*Another code*/}
)

In above expression, I use employee id to get Employee data from database using query rule. and based on employee type I call another rule where I pass some hardcoded value(1,2) for the parameter. Ideally, this expression should return me an array of 2 value but it is returning 1 value only.

However if I test condition independantly rule!getEmployeeByEmployeeId(ri!employeeId).employeeTypeId = 1 this returns me true and rule!getFormDataForEmployee(1,2) returns me array of 2 value

Has anyone faced this issue before?

Thanks
Ajinkya

OriginalPostID-251731

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer
    After adding index [1] in condition it started working (please refer below expression)

    if(
    rule!getEmployeeByEmployeeId(ri!employeeId).employeeTypeId[1] = 1,
    rule!getFormDataForEmployee(1,2),
    {/*Another code*/}
    )

    But still not sure how output of rule rule!getFormDataForEmployee(1,2) changes base on
    rule!getEmployeeByEmployeeId(ri!employeeId).employeeTypeId[1] = 1
    rule!getEmployeeByEmployeeId(ri!employeeId).employeeTypeId = 1

    As both the expression are returning true
Reply
  • 0
    Certified Lead Developer
    After adding index [1] in condition it started working (please refer below expression)

    if(
    rule!getEmployeeByEmployeeId(ri!employeeId).employeeTypeId[1] = 1,
    rule!getFormDataForEmployee(1,2),
    {/*Another code*/}
    )

    But still not sure how output of rule rule!getFormDataForEmployee(1,2) changes base on
    rule!getEmployeeByEmployeeId(ri!employeeId).employeeTypeId[1] = 1
    rule!getEmployeeByEmployeeId(ri!employeeId).employeeTypeId = 1

    As both the expression are returning true
Children
No Data