FormDataRepository.GetSubmissionData -> sortColumns not working

Rob
Rob
Vote:
 

Hi!

I'm trying to show form submissiondata on a page. I succeeded doing this with code from this forum, but I want to sort them according to the submitted date/time. I've found out that GetSubmissionData is able to take sortColumns but it just doesn't work. I guess I'm doing it wrong... Is there anybody who can say what I'm doing wrong or point me in the right direction? Thanks in advanced :)

I'm not an experienced developer in this language, so please bare with me :)

From EPiServer.Forms.Core.Data.FormDataRepository:
public virtual IEnumerable<Submission> GetSubmissionData(FormIdentity formIden, DateTime beginDate, DateTime endDate, IEnumerable<SortColumn> sortColumns, ItemRange requestRange, out ItemRange actualRange, bool finalizedOnly = false);

My code:
FormDataRepository _formDataRepository = new FormDataRepository();

var _sortColumns = new List<SortColumn>();

_sortColumns.Add(new SortColumn
{
ColumnName = "SYSTEMCOLUMN_SubmitTime",
SortDescending = true
});

IEnumerable<SortColumn> sortColumns = _sortColumns;

ItemRange itemRange = new ItemRange
{
Start = 0,
End = 3
};

List<Submission> submittedData = _formDataRepository.GetSubmissionData(
new FormIdentity(caItem.ContentGuid, "no"),
DateTime.Now.AddDays(-100),
DateTime.Now,
sortColumns,
itemRange,
out itemRange).ToList();

viewmodel.Posts = submittedData;

#228275
Edited, Sep 23, 2020 8:24
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.