Fred in Thailand Posted November 14, 2007 Posted November 14, 2007 Hello again have a date field that is an auto enter creation date. I need to format just the day name to a different color. [color:red]Mondays [color:green]Tuesday etc The field is formatted as Monday, 1 January 2007 I can't seem to get it to work Help!!!!
comment Posted November 14, 2007 Posted November 14, 2007 If this is for version 8.5, you will need to use a calculation field with a Text result for this.
Fred in Thailand Posted November 14, 2007 Author Posted November 14, 2007 (edited) Thanks for the response I kinda figured that but can't quite figure out how to do the calc. Should the date field be a text field or a calc field. And if it is set to auto enter, how do i turn it into a text field? Remember, I am still new to all this. Have tried to set it as a calc field results as text and cannot change it to display the way i wanted in the above post. Wednesday, 14 November 2007 displays as 14/11/2007. Edited November 14, 2007 by Guest
sbg2 Posted November 14, 2007 Posted November 14, 2007 Your date field should remain as a date. Create a new calculation field with Result Is Text as shown below: Case( DayOfWeek(MyDateField) = 2; TextColor ( "Monday" ; RGB ( 255 ; 0 ; 0 ) ); DayOfWeek(MyDateField) = 3; TextColor ( "Tuesday" ; RGB ( 0 ; 255 ; 0 ) ); DayOfWeek(MyDateField) = 4; TextColor ( "Wednesday" ; RGB ( 0 ; 0 ; 255 ) ) )
comment Posted November 14, 2007 Posted November 14, 2007 You should probably leave the CreationDate field as it is (if it's not a date, you won't be able to use it for finding or sorting), and add a new field defined as a calculation (result is Text) = TextColor ( DayName ( CreationDate ) ; Choose ( Mod ( CreationDate ; 7 ) ; RGB ( 0 ; 200 ; 0 ) ; RGB ( 200 ; 0 ; 0 ) ; RGB ( 0 ; 0 ; 200 ) ; RGB ( 200 ; 200 ; 0 ) ; RGB ( 0 ; 200 ; 200 ) ; RGB ( 200 ; 0 ; 200 ) ; RGB ( 200 ; 200 ; 200 ) ) ) & ", " & Day ( CreationDate ) & " " & MonthName ( CreationDate ) & " " & Year ( CreationDate ) Then use this field for displaying the date.
Fred in Thailand Posted November 15, 2007 Author Posted November 15, 2007 (edited) Again Thanks Comment, That works Beautifully, I had come to a similar solution the difference was that I got the day name in a text field and applied the formating to it. A little clumsy but it worked. This is a much more elegant solution. It was also good to learn about the chose and mod functions. Thanks again Edited November 15, 2007 by Guest
Recommended Posts
This topic is 6220 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now