Jump to content
Sign in to follow this  
MacFileman

Case (1 =

Recommended Posts

Hi...

 

Brief history. I used to be very proficient in FM... built databases is V9 in about 2010. Now I am rebuilding all my databases and making them more proficient in V13 for 2015. Yes, they rocked for 5 years!

 

Anyway, need help with a simple code. It is slowly coming back to me...

 

Case (DayName ( SOME DATE ) = 

 
"Monday" ; "MON";
"Tuesday" ;"TUE";
"Wednesday" ; "WED";
"Thursday" ; "THUR";
"Friday" ; "FRI";
"Saturday" ; "SAT";
"Sunday" ; "SUN"
 
; "HELP")
 
I constantly am returned "HELP". 
 
What am I missing??
 
My goal was to abbreviate Day of the week, and Months etc to get them to fit in a small amount of space.
 
 
 
Thanks!!

Share this post


Link to post
Share on other sites
I constantly am returned "HELP".

 

No, not exactly. If SOME DATE is a Monday, you will get "MON" as the result. All other cases will return false because your syntax is incorrect. Going by your method, it needs to be =

Case (
DayName ( StartDate ) = "Monday" ; "MON";
DayName ( StartDate ) = "Tuesday" ;"TUE";
DayName ( StartDate ) = "Wednesday" ; "WED";
DayName ( StartDate ) = "Thursday" ; "THUR";
DayName ( StartDate ) = "Friday" ; "FRI";
DayName ( StartDate ) = "Saturday" ; "SAT";
DayName ( StartDate ) = "Sunday" ; "SUN";
"HELP")

Of course a simpler method exists, e.g. =

 Upper ( Left ( DayName ( StartDate ) ; 3 ) )

(do you really need an exception for Thursday?)

Share this post


Link to post
Share on other sites

Funny enough... I solved my problem and figured out my "syntax" error, however your simpler method is freeking genius!! I just never thought about it being as simple as it actually was!

 

SUPER MANY THANKS & HAPPY NEW YEAR!!!

 

Yes... "THUR" can be "THU"

 

BRILLIANT! Thanks for the wake up call!


No more responses needed.... problem solved!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

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