Join two entities using CDT

a!localVariables(
  /* Query the parent */

  local!Employee: a!queryEntity(
    entity: cons!TOC_EmployeeEntity, 
    query: a!query(
      selection: a!querySelection(
        columns: {        
          a!queryColumn(field: "Employeeid"),
          a!queryColumn(field: "Departmentid"),

        }
      ),      
      pagingInfo: a!pagingInfo(
        startIndex: 1,
        batchSize: -1
      )
    ),

  ).data,
  
  /* Query the many-to-one child */
  local!Department: a!queryEntity(
    entity: cons!TOC_DepartmentEntity,
    query: a!query(
      selection: a!querySelection(
        columns: {        
          a!queryColumn(field: "Departmentname"),
          a!queryColumn(field: "Departmentid"),

        }
      ),      
      pagingInfo: a!pagingInfo(
        startIndex: 1,
        batchSize: -1
      )
    ),

  ).data,
  
  a!gridLayout(
    label: "EmployeeDetails",
    /*instructions: "Seleccionados: " & local!selected & local!selectedItems,*/
    headerCells: {
      a!gridLayoutHeaderCell(label: "Employeeid"),
      a!gridLayoutHeaderCell(label: "DeparmentName", align: "LEFT")

    },
    rows: a!forEach(
      items: local!Department,
      expression: a!gridRowLayout(
        id: fv!index,
        contents: {
          a!richTextDisplayField(

            value:{ 
              a!richTextItem(

                text:fv!item.Departmentid,
                color: "#1a0000",
                size: "SMALL"
              )}
          ),
          a!richTextDisplayField(
            value:{ 
              a!richTextItem(
                text:fv!item.deparmentname,
                color: "#1a0000",
                size: "SMALL"
              )}
          )


        }
      )  
    ),

  )
)

how to join the employee and department?

  Discussion posts and replies are publicly visible

Parents Reply Children