View Sorting with date as first column

Hello,

I have an embedded view. The first column is a text field in which the user enters a date. Now we need to sort this view on this first column according to the date. For doing this, we changed the formula for the first column as @Date(FieldName)…So that the view is sorted as per date…

Now on the $$Form for this view there is dropdown which is populated with all the date values from the first column of the view. When the user selects a particular date from this dropdown…the view opens with the following url :…/DocsByExpirationDate)?OpenView&StartKey=06/23/2006

Now Startkey requires the values of the first column in the view to be string. But in our case since we are converting string to date for date sorting…we lose the feature of using StartKey…

Is there any way by which i can have my first column as string and still have date sorting…or i can use first column as date and startkey as string…

Any help would be greatly appreciated.

Subject: View Sorting with date as first column

Use ?Keytype=time to search for datetime values.

See http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/ae818b3d21a6010885256f48007d7f6d?OpenDocument&Highlight=0,startkey

Subject: use string YYYY-MM-DD

as the first column

That way you can sort on it as string but have it effectively ‘date’ ordered

and teh URL open will work

Subject: RE: use string YYYY-MM-DD

Hey Alan,

Thanks for the reply. I understand that by keeping the date format as YYYY-MM-DD, the view will be sorted according to the date. But as we are using mm-dd-yyyy format, we need consistency in the date format.

neways we found an alternate way to do this…

instead of using StartKey, we used Start as the argument to OpenView. So the url was…

AllDocs?OpenView&Start=

This way we kept the first column as date…and got the feature of date sorting in the mm-dd-yyyy format…

Thanks Again.

Subject: Glad you found a good solution

Just one point however

you would’ny have had to change teh data format on any document

simply made the first column of teh view the YYYY-MM-DD string

You can certainly get this by a formula

@text( @Year(v) ) + “-” + @Right( “0” + @Text( @Month(v) ) ; 2 ) + “-” + @Right( “0” + @Text( @Day(v) ) ; 2 )

tho there may be a smarter way