Skip to main content
Known Participant
Apr 11, 2024 10:03 AM UTC
Question

Display Members of Selected Groups in Grid Columns

When selecting one or more groups, I want to display the members of those selected groups in a grid column.

Thank you!!

.

a!localVariables(
  local!selectedGroup: ri!initialGroup,
  local!distinctUsers: if(
    a!isNullOrEmpty(local!selectedGroup),
    "Please select a group",
    getdistinctusers({local!selectedGroup}),
    ),
  local!groupName:a!forEach(
    items: local!selectedGroup,
    expression: getgroupnames(fv!item)
  ),
  local!pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: 10 
  ),
  {
    a!sectionLayout(
      label: "User & Group Management",
      contents: {        
        a!pickerFieldGroups(
          label: "Pick Groups",
          labelPosition: "ABOVE",
          maxSelections: 5,
          value: ri!initialGroup,
          saveInto: ri!initialGroup,
        )
      }
    ),
    a!sectionLayout(
      label: "Group members",
      contents: {       
        a!gridField(
          label: "", 
          labelPosition: "ABOVE",
          columns: {                       
            a!forEach(
              items: local!groupName,
              expression: a!gridColumn(
                label: fv!item,
                value: a!richTextDisplayField(
                  value: local!distinctUsers
                ),
                align: "CENTER",
                width: "NARROW"
              )
            )
          },
          pagingSaveInto:local!pagingInfo
        )
      }
    )    
  }
)

12 replies

stefanhelzle0001
Brainy
Apr 11, 2024 10:13 AM UTC

Do you have a specific question?

Known Participant
Apr 11, 2024 10:16 AM UTC

I am stuck at displaying the group of members in grid. How should I do that?

venkatrea696188
Inspiring
Apr 11, 2024 10:27 AM UTC

I think your approach is wrong. Grids are used to show set of data in tabular form. Where as your data (in your code) it's more like a tree or hierarchy  . 

harshitb6843
Brainy
Apr 11, 2024 10:51 AM UTC

[mention:f489dc2b81a74ee4b45899df3c7f0f15:e9ed411860ed4f2ba0265705b8793d05] 

WHat is your usecase? Why do you want to display the members of all the selected group, in a single grid, in various columns?

Known Participant
Apr 11, 2024 11:00 AM UTC

As part of task. Where I have to use grid to display the members of all the selected group in columns.

harshitb6843
Brainy
Apr 11, 2024 11:12 AM UTC

It is not a very common use case I would say because Appian doesn't support list of list. Hence, it you try to build a list of list where the outer list signifies groups and inner signifies members, it is bound to fail. And even if you use dicitonaries, you will have to use editable grid.