Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

Hi,

We currently use the following calculation (see "a") to display a month, day, and year date (and it works great).

Now I want to add an option that will look for a certain customer number and if the result is true, then display only the month and year of a date. If the answer is false, then display the month, DAY, and year.

Example "b" shows my new calculation, but it does not work. I've been racking my brain on how to make this work including different variations...case statements, etc.. Can anyone tell me what I'm doing wrong?

a. If(LabSchedule="Monthly",Date(Month(Sample Date)+1,Day(Sample Date),Year(Sample Date)),

If(LabSchedule="45 Days",Date(Month(Sample Date),Day(Sample Date)+45,Year(Sample Date)),

If(LabSchedule="Bimonthly",Date(Month(Sample Date)+2,Day(Sample Date),Year(Sample Date)),

If(LabSchedule="Quarterly",Date(Month(Sample Date)+3,Day(Sample Date),Year(Sample Date)),

If(LabSchedule="120 Days",Date(Month(Sample Date)+4,Day(Sample Date),Year(Sample Date)),

If(LabSchedule="Semi-Annual",Date(Month(Sample Date)+6,Day(Sample Date),Year(Sample Date)),

If(LabSchedule="Annual",Date(Month(Sample Date)+12,Day(Sample Date),Year(Sample Date)),

If(LabSchedule="Random","",

If(LabSchedule="Other","",""))))))))))))))))))

b. If(LabSchedule="Monthly",Date(Month(Sample Date)+1,Day(Sample Date),Year(Sample Date)),

If(LabSchedule="45 Days",Date(Month(Sample Date),Day(Sample Date)+45,Year(Sample Date)),

If(LabSchedule="Bimonthly",Date(Month(Sample Date)+2,Day(Sample Date),Year(Sample Date)),

If(LabSchedule="Quarterly",Date(Month(Sample Date)+3,Day(Sample Date),Year(Sample Date)),

If(LabSchedule="120 Days",Date(Month(Sample Date)+4,Day(Sample Date),Year(Sample Date)),

If(LabSchedule="Semi-Annual",Date(Month(Sample Date)+6,Day(Sample Date),Year(Sample Date)),

If(LabSchedule="Annual",Date(Month(Sample Date)+12,Day(Sample Date),Year(Sample Date)),

If(Customer# = "145" and LabSchedule="Monthly",Date(Month(Sample Date)+1,Year(Sample Date),

If(Customer# = "145" and LabSchedule="Bimonthly",Date(Month(Sample Date)+2,Year(Sample Date),

If(Customer# = "145" and LabSchedule="Quarterly",Date(Month(Sample Date)+3,Year(Sample Date),

If(Customer# = "145" and LabSchedule="120 Days",Date(Month(Sample Date)+4,Year(Sample Date),

If(Customer# = "145" and LabSchedule="Semi-Annual",Date(Month(Sample Date)+6,Year(Sample Date),

If(Customer# = "145" and LabSchedule="Annual",Date(Month(Sample Date)+12,Year(Sample Date),

If(LabSchedule="Random","",

If(LabSchedule="Other","",""))))))))))))))))))

Posted

Try something like:

Let ( [

newDate =

Case (

LabSchedule = "Monthly" ;

Date ( Month ( Sample Date ) + 1 ; Day ( Sample Date ) ; Year ( Sample Date ) ) ;

LabSchedule = "45 Days" ;

Date ( Month ( Sample Date ) ; Day ( Sample Date ) + 45 ; Year ( Sample Date ) ) ;

LabSchedule = "Bimonthly" ;

Date ( Month ( Sample Date ) + 2 ; Day ( Sample Date ) ; Year ( Sample Date ) ) ;

LabSchedule = "Quarterly" ;

Date ( Month ( Sample Date ) + 3 ; Day ( Sample Date ) ; Year ( Sample Date ) ) ;

LabSchedule = "120 Days" ;

Date ( Month ( Sample Date ) + 4 ; Day ( Sample Date ) ; Year ( Sample Date ) ) ;

LabSchedule = "Semi-Annual" ;

Date ( Month ( Sample Date ) + 6 ; Day ( Sample Date ) ; Year ( Sample Date ) ) ;

LabSchedule = "Annual" ;

Date ( Month ( Sample Date ) ; Day ( Sample Date ) ; Year ( Sample Date ) + 1 ) ;

)

] ;

Case (

Customer# = "145" and not isEmpty ( newDate ) ; Month ( newDate ) & "/" & Year ( newDate ) ;

GetAsText ( newDate )

)

)

Posted

Hi,

Thanks for the response. I know it says I'm working on Dev 7; but for this scenorio it is actually for FileMaker 6. So I'm thinking that solution won't work. ???-( Sorry about that. Any other suggestions?

Posted

Yes it will. Define an interim calculation field cNewDate (result is Date ) =

Case (

LabSchedule = "Monthly" ,

Date ( Month ( Sample Date ) + 1 , Day ( Sample Date ) , Year ( Sample Date ) ) ,

LabSchedule = "45 Days" ,

Date ( Month ( Sample Date ) , Day ( Sample Date ) + 45 , Year ( Sample Date ) ) ,

LabSchedule = "Bimonthly" ,

Date ( Month ( Sample Date ) + 2 , Day ( Sample Date ) , Year ( Sample Date ) ) ,

LabSchedule = "Quarterly" ,

Date ( Month ( Sample Date ) + 3 , Day ( Sample Date ) , Year ( Sample Date ) ) ,

LabSchedule = "120 Days" ,

Date ( Month ( Sample Date ) + 4 , Day ( Sample Date ) , Year ( Sample Date ) ) ,

LabSchedule = "Semi-Annual" ,

Date ( Month ( Sample Date ) + 6 , Day ( Sample Date ) , Year ( Sample Date ) ) ,

LabSchedule = "Annual" ,

Date ( Month ( Sample Date ) , Day ( Sample Date ) , Year ( Sample Date ) + 1 ) ,

)

Now make your final calculation field (result is Text) =

Case (

Customer# = "145" and not isEmpty ( cNewDate ) ,

Month ( cNewDate ) & "/" & Year ( cNewDate ) ,

DateToText ( cNewDate )

)

This topic is 7143 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.