Display files in a folder and sorting them

Hi folks,

I have the following code but I need to sort the files by the latest created on date. I have tried but it gives a datatype error. 

 

load(
local!data: {
{
id: 1,
folderId:ri!folderId/* Folder ids*/

}
},
local!doc: tointeger(
a!forEach(
items: index(
local!data,
"folderId",
{}
),
expression: folder(
fv!item,
"documentChildren"
)
)
),
local!pagingInfo: a!pagingInfo(
startIndex: 1,
batchSize: 10

),
with(
local!currentData: todatasubset(
local!doc,
local!pagingInfo
),
a!gridField(
label: "",
labelPosition: "ABOVE",
totalCount: if(
rule!Utils_CheckIsNull(
local!doc
),
0,
length(
local!doc
)
),
columns: {
a!gridTextColumn(
label: "Document",
data: a!forEach(
items: local!currentData,
expression: document(
fv!item,
"name"
)
),
links: a!forEach(
items: local!currentData,
expression: a!documentDownloadLink(
document: fv!item
)
)
),
a!gridTextColumn(
label: "Version",
data: a!forEach(
items: local!currentData,
expression: document(
fv!item,
"totalNumberOfVersions"
)
)
),
a!gridTextColumn(
label: "Uploaded By",
data: a!forEach(
items: local!currentData,
expression: document(
fv!item,
"lastUserToModify"
)
)
),
a!gridTextColumn(
label: "Created On",
data: a!forEach(
items: local!currentData,
expression: document(
fv!item,
"dateCreated"
)
)
)

},
saveInto: local!pagingInfo,
value: local!pagingInfo
)
)
)

 

 

 Any help would be appreciated. TIA! 

 

 

 

 

 

 

 

 

 

  Discussion posts and replies are publicly visible