Sorting problem

Hi all,

i have the next mayor problem.

For a print form i use (wich has to be sorted on date)

i use 3 type of fields; date, time & text.

to let them sort equally i combined the 3 fields in one field (and made text from the dat & time field because notes doesn’t like it when text, date & time are in one field) and sorted them at the end of the formula.

Then i have another 2 fields (these two are the two fields wich has to be seen when displayed for web or in a notes client, 1 has to contain the date and time and the other contains the text, i used the @middle formula to only show the part with the date & time in one field and in the other one i also used the @middle formula to only show the text), now when i check it in Notes or on the web it sorts, but here is the problem…it sorts on the date (that’s ok), but not proper, a normal date field sorts on the month and now because i used the @text on the date & time to combine them with the text field, it sorts on the day and not on the month.

This is a mayor problem for me, because i spent a lot of time on this and i really tought it would work…

Hope someone can help me…

Thanx,

Neill

Subject: RE: Sorting problem…

Never store dates in text form. Since different workstations format dates differently, it leads to confusion and inconsistent formatting of your data. Use the Date/time field type – that’s what it’s for. Do not try to combine date/time values with numbers or text in the same field. Use three separate fields for your three separate data items.

Never use text functions to extract parts of a date/time value. When you do so, once again you are making an assumption about how the user’s workstation formats dates. The information you extract with @Middle might not be in the same place in the string when someone else’s computer does it.

You could make your view column sort properly using @TextToTime, but that’s not the right way to do it for the reasons given above. The server’s date formatting would have to match the workstation’s date formatting for all users, so all users would have to match.

Subject: Try This…

Y1 := @Text(@Year(DateField));M1 := @Right(“0” + @Text(@Month(DateField)); 2);

D1 := @Right(“0” + @Text(@Day(DateField)); 2);

H1 := @Right(“0” + @Text(@Hour(DateField)); 2);

N1 := @Right(“0” + @Text(@Minute(DateField)); 2);

S1 := @Right(“0” + @Text(@Second(DateField)); 2);

C21 := @Char(21);

SField := TextField + C21 + Y1 + C21 + M1 + C21 + D1 + C21 + H1 + C21 + N1 + C21 + S1 + C21 + YourOtherTextField;

Sorted := @Sort(SField);

FIELD STextField := @Word(Sorted; C21; 1);

FIELD SYourOtherTextField := @Word(Sorted; C21; 8);

Y1 := @Word(Sorted; C21; 2);

M1 := @Word(Sorted; C21; 3);

D1 := @Word(Sorted; C21; 4);

H1 := @Word(Sorted; C21; 5);

N1 := @Word(Sorted; C21; 6);

S1 := @Word(Sorted; C21; 7);

Date1 := @Date(Y1[1]; M1[1]; D1[1]; H1[1]; N1[1]; S1[1]);

@For(n := 2; n <= @Elements(Y1); n := n + 1;Date1 := Date1 : @Date(Y1[n]; M1[n]; D1[n]; H1[n]; N1[n]; S1[n]));

Field SDateField := Date1;

Boy would it not be nice if @Date took MultiValue parms like every other @function?