Jump to content
Sign in to follow this  
CCBtx

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

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.

Share this post


Link to post
Share on other sites

I am confused: you started with a calculation field - then suddenly you are speaking of variables and scripts.

If I had to take a guess, you are populating a merged variable - but as there is nothing to cause a refresh of display...

Share this post


Link to post
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.

Share this post


Link to post
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".

Share this post


Link to post
Share on other sites

Ok, Thanks. You are correct. I should have said "field".

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Who Viewed the Topic

    1 member has viewed this topic:
    SRBENET 
×
×
  • Create New...

Important Information

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