Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted

Hello All

I have a set variable that is equal to:

If(Get ( CurrentTime )

If I have a calc field set to this it works, if I use a variable it does not.

The overall program is for a time clock I am developing. The above equation is for people working overnight, and there last punch is actually on a new day, but needs to be on the previous day.

I have double checked the "Yesterday Problem" field, and that is working perfectly, and so are the other fields mentioned.

Do variables get calculated differently? The calc field had to be "unstored." The variable is not stored either, it is not a global variable, and it is cleared at the end of the script.

Any ideas?

Posted

Do variables get calculated differently? The calc field had to be "unstored." The variable is not stored either, it is not a global variable, and it is cleared at the end of the script.

Variables in scripts are calculated differently from calculated fields in two potentially significant ways.

(1) Because they are in scripts, you need to execute the script in the correct context, i.e. layout. A calculated field has an explicit context when you define it. You might be in the wrong context when running a script if you aren't careful about the layout you're on when it is running.

(2) Script variables are always text values. This can have some gotchas when doing non-text comparisons unless you explicitly convert the values, e.g. GetAsNumber().

Posted

I double checked and it is using the correct layout. I thought that may be it at first.

Concerning your other point, I understand that the variable result needs to be text, but does every part of the equation? For instance if I have trigger that relies on a field equaling zero, does it need to be the text zero?

Posted

Can you explain what exactly doesn't work? With the Advanced version, you can use script debugger and data viewer to see the variable's value at each step.

Posted

For instance if I have trigger that relies on a field equaling zero, does it need to be the text zero?

Comparisons with zero should be fine. I was thinking along the lines of $myVar is "3" then a text string comparison will yield "3" > "20" since that is how they would be alpha-ordered.

Posted

The variable should either today name or yesterdays name. When that is determined, it places the punch in the appropriate place.

It works great in testing. Something is not working in the wee hours of the morning though.

It is boggling me, because all the criteria are met, but it still returns today's name instead of yesterdays.

Posted

I finally got it! The problem was with one of the fields that was used in the equation. It was not set to not store the data, and to recalculate when needed.

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