Document Sorting for documents retrieving from Knowledge Center

A Score Level 1

Hi,

Is there any way to sort the documents which are retrieved from knowledge center.

Below is my code:

a!gridField(
label: "Documents Uploaded",
labelPosition: "ADJACENT",
totalCount: count(
CDT.fileUpload
),
columns: {
a!gridTextColumn(
label: "Document Name",
data: {
a!forEach(
items: CDT.fileUpload,
expression: document(
fv!item,
"name"
)
)
},
links: a!forEach(
items: CDT.fileUpload,
expression: a!documentDownloadLink(
document: {
fv!item
}
)
),
alignment: "LEFT"
),
a!gridTextColumn(
label: "Date & Time",
data: {
a!forEach(
items: CDT.fileUpload,
expression: text(
document(
fv!item,
"dateCreated"
),
"dd mmm yyyy AM/PM"
)
)
}
)
},
value: a!pagingInfo(
startIndex: 1,
batchSize: count(
CDT.fileUpload
)
),
saveInto: {},
validations: {},
shadeAlternateRows: true
)

I have attached screenshot for the same. Now I want to sort documents on any of the columns.

 

 

  Discussion posts and replies are publicly visible

Parents
  •  : AFAIK Can you please try below code:

    Code:

    load(
      /*Smaple  Dictionary Data*/
      local!cdt: {
        {
          fileUpload: 110577
        },
        {
          fileUpload: 110576
        }
      },
      local!pagingInfo: a!pagingInfo(
        startIndex: 1,
        batchSize: - 1,
        sort: a!sortInfo(
          field: "fileUpload",
          ascending: true()
        )
      ),
      with(
        local!dataSubset: todatasubset(
          local!cdt,
          local!pagingInfo
        ),
        a!gridField(
          label: "Documents Uploaded",
          labelPosition: "ADJACENT",
          totalCount: local!dataSubset.totalCount,
          columns: {
            a!gridTextColumn(
              label: "Document Name",
              field: "fileUpload",
              data: {
                a!forEach(
                  items: local!dataSubset.data.fileUpload,
                  expression: document(
                    fv!item,
                    "name"
                  )
                )
              },
              links: a!forEach(
                items: local!dataSubset.data.fileUpload,
                expression: a!documentDownloadLink(
                  document: {
                    fv!item
                  }
                )
              ),
              alignment: "LEFT"
            ),
            a!gridTextColumn(
              label: "Date & Time",
              field: "fileUpload",
              data: {
                a!forEach(
                  items: local!dataSubset.data.fileUpload,
                  expression: text(
                    document(
                      fv!item,
                      "dateCreated"
                    ),
                    "dd mmm yyyy AM/PM"
                  )
                )
              }
            )
          },
          value: local!pagingInfo,
          saveInto: {
            local!pagingInfo
          },
          validations: {},
          shadeAlternateRows: true
        )
      )
    )

Reply
  •  : AFAIK Can you please try below code:

    Code:

    load(
      /*Smaple  Dictionary Data*/
      local!cdt: {
        {
          fileUpload: 110577
        },
        {
          fileUpload: 110576
        }
      },
      local!pagingInfo: a!pagingInfo(
        startIndex: 1,
        batchSize: - 1,
        sort: a!sortInfo(
          field: "fileUpload",
          ascending: true()
        )
      ),
      with(
        local!dataSubset: todatasubset(
          local!cdt,
          local!pagingInfo
        ),
        a!gridField(
          label: "Documents Uploaded",
          labelPosition: "ADJACENT",
          totalCount: local!dataSubset.totalCount,
          columns: {
            a!gridTextColumn(
              label: "Document Name",
              field: "fileUpload",
              data: {
                a!forEach(
                  items: local!dataSubset.data.fileUpload,
                  expression: document(
                    fv!item,
                    "name"
                  )
                )
              },
              links: a!forEach(
                items: local!dataSubset.data.fileUpload,
                expression: a!documentDownloadLink(
                  document: {
                    fv!item
                  }
                )
              ),
              alignment: "LEFT"
            ),
            a!gridTextColumn(
              label: "Date & Time",
              field: "fileUpload",
              data: {
                a!forEach(
                  items: local!dataSubset.data.fileUpload,
                  expression: text(
                    document(
                      fv!item,
                      "dateCreated"
                    ),
                    "dd mmm yyyy AM/PM"
                  )
                )
              }
            )
          },
          value: local!pagingInfo,
          saveInto: {
            local!pagingInfo
          },
          validations: {},
          shadeAlternateRows: true
        )
      )
    )

Children
No Data