Jump to content

Plain-text translation of Case statment


This topic is 8535 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

Hi

Can anyone give me a plain text translation of the following statement from John Mark Osborne's Format.fp3 solution:

Case(Mod Time, Serial, Serial)?

Specifically, I am trying to figure out what it means in a case statement when the test condition does not contain a comparison operator (such as "Mod Time>12:00").

I read it as "If Mod Time has any value, insert the value for Serial into [the field being calculated]; if it doesn't have a value, do the same thing."

I have adapted his solution for replacing unformatted (or incorrectly formatted) text with a formatted version (in my case, dates), but I need it to work on new records automatically. The key appears to be putting something in that test-condition other than a modification time-based trigger, since a new record doesn't have a "modify time."

Thanks for any clarifications anyone can offer.

------------------

Link to comment
Share on other sites

The first argument in a Case statement is evaluated as a boolean. It can be a comparison, A <= 5 which evaluates to a 1 or zero, true or false. It can also be a numeric field. Zero values in a numeric field are evaluated as "False" or zero, non-zero values are evaluated as "True" or one.

The variable defined as:

Case(Mod Time, Serial, Serial)

would have the value of the field Serial regardless of whether Mod Time was True or False. John Mark is obviously using some trick here. Without more information to put this in context, I can't guess further. -bd

Link to comment
Share on other sites

This topic is 8535 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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