Confiform Datetime interval sorting
Asked by Markisio:

Hi There

I have confiform with Datetime Interval field, when I display the data of that form and try to sort it by the Datetime interval it doesn't work, here is the details

datetime interval field name is **duration**

in tableview, sorting by startDate of the duration: I did **duration.startDate ASC**

I notice its sorting it as a string, below is what get displayed

April 1, 2023

June 1, 2023

May 1, 2023

it seems its sorting by letters of the month rather by date. Please look at June and May

I tried using formatDate function: **duration.startDate(MMM, UTC) ASC** but no luck

please advise, much appreciated


Answers:
author: Alex Medved _ConfiForms_
body: Hi

This works absolutely perfect for me when I try

![Screenshot 2023-05-19 at 23.10.46.png](https://community.atlassian.com/t5/image/serverpage/image-id/258426i6AE5D828BCD74FA3/image-size/large?v=v2&px=999 "Screenshot 2023-05-19 at 23.10.46.png")

With the storage format as below

```
<ac:structured-macro ac:name="confiform" ac:schema-version="1" ac:macro-id="8515674c-1fe7-4d03-abfc-920405ea6d51"><ac:parameter ac:name="formName">f</ac:parameter><ac:rich-text-body><ac:structured-macro ac:name="confiform-entry-register" ac:schema-version="1" ac:macro-id="a835064e-d533-48b1-a114-ed27dfba04b1"><ac:rich-text-body><p><br /></p></ac:rich-text-body></ac:structured-macro><p><ac:structured-macro ac:name="confiform-field-definition" ac:schema-version="1" ac:macro-id="60a95d9a-36a3-4ac8-97bf-5a405cb899d8"><ac:parameter ac:name="fieldName">duration</ac:parameter><ac:parameter ac:name="fieldLabel">duration</ac:parameter><ac:parameter ac:name="type">datetimeinterval</ac:parameter></ac:structured-macro></p></ac:rich-text-body></ac:structured-macro><ac:structured-macro ac:name="confiform-table" ac:schema-version="1" ac:macro-id="14dac29d-5d9b-4deb-9b0a-4e366eb092a7"><ac:parameter ac:name="formName">f</ac:parameter><ac:parameter ac:name="sort">duration.startDate ASC</ac:parameter><ac:rich-text-body><p><br /></p></ac:rich-text-body></ac:structured-macro>
```

Alex

comments: author: Markisio
body: Hi [@Alex Medved _ConfiForms_](/t5/user/viewprofilepage/user-id/781630)

not with me, see attached below, the only difference is I made interval 0 to remove time In form definition. Not sure if that's why?

![IMG_0295.jpeg](https://community.atlassian.com/t5/image/serverpage/image-id/258454iB2A03B5AB073E8B5/image-size/large?v=v2&px=999 "IMG_0295.jpeg")![IMG_0296.jpeg](https://community.atlassian.com/t5/image/serverpage/image-id/258455iAD3D8EC451E4A72D/image-size/large?v=v2&px=999 "IMG_0296.jpeg")


author: Alex Medved _ConfiForms_
body: Same correct result for me, no matter what the "interval for time slots" setting is chosen

What version of the ConfiForms plugin are you using?


author: Markisio
body: hi [@Alex Medved _ConfiForms_](/t5/user/viewprofilepage/user-id/781630)

<br />

My version 2.18.13

See screenshot below where I have the table view in a different page than the form definition

![IMG_0299.jpeg](https://community.atlassian.com/t5/image/serverpage/image-id/258475iF01A7F20C14C737B/image-size/large?v=v2&px=999 "IMG_0299.jpeg")  

![IMG_0300.jpeg](https://community.atlassian.com/t5/image/serverpage/image-id/258476i689D0AF8312A39AB/image-size/large?v=v2&px=999 "IMG_0300.jpeg")


author: Alex Medved _ConfiForms_
body: Hi

It does not matter where the form's data is used - sorting is applied on the backend, and works absolutely the same way

I can see that you are like few years behind the current version of ConfiForms

Consider updating the plugin

Alex


author: Markisio
body: Ok thanks, will ask the team who is responsible of the tool to upgrade. Thanks again


Tags: confiforms

confluence-server

server