Skip to main content
erazemk6135
February 2, 2024
Solved

Comparing groups using union

  • February 2, 2024
  • 4 replies
  • 0 views

Hello,

I have an application with users that have multiple groups that describe their roles and teams. I have a group type that specifically targets which team a person is on. I have a pointer to that type.

I want to get a member of another role (group) from this same team automatically. Technically what I am having a problem with is the following:



union(

a!groupsByType(cons!TA1_ProjectTeamsPointer).data,

a!groupsForUser("testuser")

)

This gives me the following error:

Expression evaluation error at function 'union': Invalid types, can only act on data of the same type (Any Type, Key (Integer))

So the union arguments are of different types? But the documentation explicitly states for both methods that the type is 'list of group'. Is the documentation wrong? How do I convert 'Any type' to list of group?
When I test the arguments individually, the raw outputs seem the same to me.
Thank you in advance.
Best answer by harshitb6843

Just wrap both of the parameters in togroup()

union(
  togroup(
    a!groupsByType(cons!TA1_ProjectTeamsPointer).data
  ),
  togroup(a!groupsForUser("testuser"))
)

4 replies

harshitb6843
February 2, 2024

Just wrap both of the parameters in togroup()

union(
  togroup(
    a!groupsByType(cons!TA1_ProjectTeamsPointer).data
  ),
  togroup(a!groupsForUser("testuser"))
)

erazemk6135
February 2, 2024

Thank you. Regarding my question about the type, is documentation missing about the type of the result of these two methods? Because in the documentation it seems to me both are of the same type. 

Links:
https://docs.appian.com/suite/help/23.4/fnc_people_a_groupsbytype.html 
https://docs.appian.com/suite/help/23.4/fnc_people_a_groupsforuser.html

harshitb6843
February 2, 2024

Just tried and it looks like the output for both of these functions are different. One gives a list of variants vs the other gives a list of groups.