how to get the nested CDT Data

I have an Employee CDT and Documents CDT(One to many Relation Ship between them) documents table has foreign key empId ,i wanted to get the documents based on empId (foreign key)

if i write expression like

 a!queryEntity(
entity: cons!DOCUMENTS_DETAILS,
query: a!query(
pagingInfo: a!pagingInfo(
startIndex: 1,
batchSize: - 1
),
filter: a!queryFilter(
field: "empId"( as foreign key in  documents table but empId field is not there  in Documents CDT),
operator: "in",
value:7
)
)
).data


so i am getting following error The field [empId] does not exist.. in such case how to get the nested CDT Data.

  Discussion posts and replies are publicly visible

Parents
  • Hi,

    If the Employee CDT has the nested CDT Document_Details, then fetch the details from Employee_Detail, you will get the Document_Details also.
  • Hi vinay,

    I wanted to display documents in paging grid.if i fetch documents through employee the total count as 1 because i am fetching through employee by passing empId

    a!queryEntity(
    entity: cons!EMPLOYEE_DATA,
    query: a!query(
    pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: - 1
    ),
    filter: a!queryFilter(
    field: "orgEmpId",
    operator: "=",
    value: ri!empId
    )
    )
    )
    o/p : startIndex: 1
    batchSize: -1
    sort: List of SortInfo: 1 item
    SortInfo
    field: "nationality"
    ascending: true
    totalCount: 1

    i have 3 documents for employee but if i fetch the documents through employee the total count as 1 while paging in grid i am getting following error

    a!gridField [line 24]: A grid component [label=“”] has an invalid value for “totalCount”. “totalCount” must not be null or less than the number of items in any of the “data” arrays, but “totalCount” was 1 and the largest column data array had 5 items.
  • your employee data count is 1 but your documents count is multiple so,send the document count as total count to your grid(local!empData.documents )
Reply Children
No Data