Jump to content

Calculating Field... not calculating... the first time.


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

Recommended Posts

I love these undocumented features. :hmm:

I have a calculating field named "TakeHome.Gross.Monthly" in the table LeaseCalc

The calculation is:

((LeaseCalc::TakeHome.PerPayPeriod.Person1 * PayPeriodFreq1::TimesPerYear) +

(LeaseCalc::TakeHome.PerPayPeriod.Person2 * PayPeriodFreq2::TimesPerYear))/12

So, if

LeaseCalc::TakeHome.PerPayPeriod.Person1 = 5000;

PayPeriodFreq1::TimesPerYear = 24;

LeaseCalc::TakeHome.PerPayPeriod.Person2 = 0; and

PayPeriodFreq2::TimesPerYear

Then "TakeHome.Gross.Monthly" would = 10,000 or $10,000 per month.

The variable appears on the second tab of a tab object.

Here is the problem. The first time my script runs (which sets the variables in the calculation)... and then switches to the appropriate tab, the value of the variable shows "0"

If I run the exact same script again... (which sets the variables in the calculation) the value populates.

Does anyone have any ideas? :grad:

BTW... one of the variables in the script, is the relationship variable that links to the table PayPeriodFreq1 and 2

If I look at all of the variables INDIVIDUALLY inside of Data Viewer, they all return the correct values.. except for the calculating field, "TakeHome.Gross.Monthly". And, again, once I run the same exact script the second time, the field populates.

One more thing. This only happens the FIRST time I run the script after I initially open the database. Once the script has executed twice, the variable populates properly from that point onward.

Thanks a lot.

Link to comment
Share on other sites

I'm confused as well.

I "triggered" the calculation field update by (i) committing the record and then (ii) resetting one of the variables inside the calculation.

Also, I forgot to mention that the calculation field is a global.

Thanks a lot for looking.

Link to comment
Share on other sites

the calculation field is a global.

The calculation field should be unstored, since it references related fields. Then you won't need a script to trigger a refresh - it will re-evaluate on every screen redraw.

P.S. Please don't say "variable" when you mean "field".

Link to comment
Share on other sites

  • 2 weeks later...

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