AnsweredAssumed Answered

Calculation not evaluating as expected...

Question asked by PaulSeabright on Nov 2, 2017
Latest reply on Nov 2, 2017 by schamblee

I am using this calculation to show or hide a field on a form, and it's not behaving as expected.

Let (

      [timeDifference = (Get(CurrentTimeUTCMilliseconds) - Globals::g_LastZyncTime);

 

      delay = Case ( DayName ( Get(CurrentDate ) = "Sunday"); 262800000;

                               DayName ( Get(CurrentDate ) = "Monday"); 345600000;

                               DayName ( Get(CurrentDate ) = "Tuesday"); 432000000; 17640000 )  ];

 

If ( (timeDifference < delay);1)

    )

 

To day is Friday, so I expect the field to be visible - it's not :-(

If I change the value 262800000 to 28280000, the field is shown - but why would that make a difference if today is Friday?

 

To try and further understand what is happening, I recreated the above as a script.

This behaves like the let statement - the If line drops into the first branch and sets $delay to 262800000, not the default 176400000 as I would expect as its Friday.

 

What is going on!!  What silly mistake or assumption have I made?  Twice!!

 

Windows 7 64bit

FMPAdv 16.0.3.302

Outcomes