Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Sorting dates in a text box

Featured Replies

  • Author

I have a Text field where I can record activity- calls to clients, projects etc. Each activity starts with the date (as 12/10/05 but in the text box). I now need to sort the records by the date of the activity entered.

Of course, when I do a sort at the moment, it does it by the first digits- which is completely wrong for the months & years.

Is there any way to force Sort to recognise the first 6 characters as a date & correctly Sort?

I have a Text field where I can record activity- calls to clients, projects etc. Each activity starts with the date (as 12/10/05 but in the text box). I now need to sort the records by the date of the activity entered.

Of course, when I do a sort at the moment, it does it by the first digits- which is completely wrong for the months & years.

Is there any way to force Sort to recognise the first 6 characters as a date & correctly Sort?

  • Author

I have a Text field where I can record activity- calls to clients, projects etc. Each activity starts with the date (as 12/10/05 but in the text box). I now need to sort the records by the date of the activity entered.

Of course, when I do a sort at the moment, it does it by the first digits- which is completely wrong for the months & years.

Is there any way to force Sort to recognise the first 6 characters as a date & correctly Sort?

Would your field look like this, one entry per text field

12/10/05 text text text

Or More than one entry per text field

12/10/04 text text text

12/12/04 text text text

01/15/05 text text text

Next, is the date consistent as 12/10/04 or more like this:

1/1/05

01/01/05

1/01/05

01/1/05

01/01/2005

Lee

Would your field look like this, one entry per text field

12/10/05 text text text

Or More than one entry per text field

12/10/04 text text text

12/12/04 text text text

01/15/05 text text text

Next, is the date consistent as 12/10/04 or more like this:

1/1/05

01/01/05

1/01/05

01/1/05

01/01/2005

Lee

Would your field look like this, one entry per text field

12/10/05 text text text

Or More than one entry per text field

12/10/04 text text text

12/12/04 text text text

01/15/05 text text text

Next, is the date consistent as 12/10/04 or more like this:

1/1/05

01/01/05

1/01/05

01/1/05

01/01/2005

Lee

  • Author

Hi Lee,

text is like this:

12/10/04 text text text

12/12/04 text text text

01/15/05 text text text

but I only need to view the first line- so I can see most recent activities when looked at as a list.

Dates are consistent as 6 digits: 01/01/05

Many thanks for your help- this problem has been irking me all day!

  • Author

Hi Lee,

text is like this:

12/10/04 text text text

12/12/04 text text text

01/15/05 text text text

but I only need to view the first line- so I can see most recent activities when looked at as a list.

Dates are consistent as 6 digits: 01/01/05

Many thanks for your help- this problem has been irking me all day!

  • Author

Hi Lee,

text is like this:

12/10/04 text text text

12/12/04 text text text

01/15/05 text text text

but I only need to view the first line- so I can see most recent activities when looked at as a list.

Dates are consistent as 6 digits: 01/01/05

Many thanks for your help- this problem has been irking me all day!

The text field sorts correctly - after all, it IS a text field, and FMP cannot be expected to guess the meaning of the text.

You can add a calculation field (result date) =

Date (

Left ( text ; 2 ) ;

Middle ( text ; 4 ; 2 ) ;

"20" & Middle ( text ; 7 ; 2 )

)

and sort on that.

Note that this assumes the year is in the present century; if you have entries like 01/01/99, it needs to be enhanced a bit.

The text field sorts correctly - after all, it IS a text field, and FMP cannot be expected to guess the meaning of the text.

You can add a calculation field (result date) =

Date (

Left ( text ; 2 ) ;

Middle ( text ; 4 ; 2 ) ;

"20" & Middle ( text ; 7 ; 2 )

)

and sort on that.

Note that this assumes the year is in the present century; if you have entries like 01/01/99, it needs to be enhanced a bit.

The text field sorts correctly - after all, it IS a text field, and FMP cannot be expected to guess the meaning of the text.

You can add a calculation field (result date) =

Date (

Left ( text ; 2 ) ;

Middle ( text ; 4 ; 2 ) ;

"20" & Middle ( text ; 7 ; 2 )

)

and sort on that.

Note that this assumes the year is in the present century; if you have entries like 01/01/99, it needs to be enhanced a bit.

You should create a calculation with the result = to date field and parse out the date.

You can start with this, and then one of the experts (hello Queue) will come along and clean it up or give you a better one.

TextToDate(Left(Text, 2) &"/" & Middle(Text, 4, 2 ) &"/" &"20" & Middle(Text, 7, 2))

HTH

Lee

Or, while I was out testing mine, along came comment with one, a tad different. I agree with the assumption that you will not have 1999 or earlier as a current contact date.

:P

You should create a calculation with the result = to date field and parse out the date.

You can start with this, and then one of the experts (hello Queue) will come along and clean it up or give you a better one.

TextToDate(Left(Text, 2) &"/" & Middle(Text, 4, 2 ) &"/" &"20" & Middle(Text, 7, 2))

HTH

Lee

Or, while I was out testing mine, along came comment with one, a tad different. I agree with the assumption that you will not have 1999 or earlier as a current contact date.

:

You should create a calculation with the result = to date field and parse out the date.

You can start with this, and then one of the experts (hello Queue) will come along and clean it up or give you a better one.

TextToDate(Left(Text, 2) &"/" & Middle(Text, 4, 2 ) &"/" &"20" & Middle(Text, 7, 2))

HTH

Lee

Or, while I was out testing mine, along came comment with one, a tad different. I agree with the assumption that you will not have 1999 or earlier as a current contact date.

:

Sorry about that.

I don't particularly like relying on the "/" separators - move it to another system, and it breaks. However, if you want to approach it that way, then you can make it simply:

GetAsDate ( Left ( Text ; 8 ) )

Might be actually better in this case, since here FMP will automatically assign "19" to all years above 35.

Sorry about that.

I don't particularly like relying on the "/" separators - move it to another system, and it breaks. However, if you want to approach it that way, then you can make it simply:

GetAsDate ( Left ( Text ; 8 ) )

Might be actually better in this case, since here FMP will automatically assign "19" to all years above 35.

Sorry about that.

I don't particularly like relying on the "/" separators - move it to another system, and it breaks. However, if you want to approach it that way, then you can make it simply:

GetAsDate ( Left ( Text ; 8 ) )

Might be actually better in this case, since here FMP will automatically assign "19" to all years above 35.

  • Author

Thanks!!

GetAsDate ( Left ( Text ; 8 ) ) very elegantly fixed the problem & everyhting now Sorts exactly as I wanted it.

Again, many thanks to you all.

  • Author

Thanks!!

GetAsDate ( Left ( Text ; 8 ) ) very elegantly fixed the problem & everyhting now Sorts exactly as I wanted it.

Again, many thanks to you all.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.