Solved

Can I force a re-evaluation of calculated fields?

Posted on 2006-11-18
5
1,624 Views
Last Modified: 2008-01-09
I have a FM7 database that I use to track an investment club stock portfolio.  There are four tables:  ClubAssets, Stock, StockTransactions, and StockPrice.  In one of the Stock table layouts, I display the stock's current price, which comes from the related record in the StockPrice table.  I update the StockPrice table by first deleting all old records, then importing a tab-delimited file downloaded from the Internet, using a script.  After the new prices have been imported, the price shown in the Stock table layout is still the old price.  I have to move to the next record and then back to the original record to force the price to update.  Is there a way to tell FileMaker to perform this re-evaluation from within my import script or by some other automated means?

Thanks in advance for your help.
0
Comment
Question by:ronlow
  • 3
  • 2
5 Comments
 
LVL 28

Expert Comment

by:lesouef
ID: 17974035
how is the stock value entered in the stock table? calculated field, looked-up value? auto-entered value?
if it is a looked-up value as I think it is, after import, goto the stock table, and use the "relookup field content"s on the stock item field (the field used to link to the stock price table)
0
 

Author Comment

by:ronlow
ID: 17977223
The stock's price in the Stock table is a calculation: CurrentPrice = StockPrice::ClosingPrice.  Not much of a calculation, I agree, but there are other fields that do have a real calculation (TotalStockValue, for instance).  I was just taking the simplest case.

I changed CurrentPrice to a looked-up value and tried your suggestion.  It worked perfectly.  I am going to go through the rest of the fields to see if there are any situations where this strategy won't work.

Thanks for your suggestion.
0
 
LVL 28

Accepted Solution

by:
lesouef earned 250 total points
ID: 17977797
Is the Currentprice a calculation field or a number field auto-entered from a calculation? in the 1st case, it should update automatically. In the later, no, the value is set at record creation time, and only changes if you reselect the item. So the look-up value is better for you as there is no calculation, but just a ref to take.
0
 

Author Comment

by:ronlow
ID: 17984537
The CurrentPrice field is a calculation field.  It will update automatically, but only if you "tickle" it first.  I found that moving to the next record and then back to the original would force a re-evaluation/redisplay, and if I moved to a different layout and then back to the original, it would also force a re-evaluation/redisplay.  If you do the layout move in a script, it happens so fast that the current layout simply appears to refresh.  The problem with the "tickle" method is that it is specific to an individual table.  I have a field in ClubAssets called TotalPortfolioValue that is the sum of all the stock's TotalStockValue amounts, and to get that field to update, I have to "tickle" that table too.

The beauty in defining CurrentPrice as a look-up, as you suggested, is that performing the "relookup field contents" step has a domino effect that updates all fields that are dependent on the value of CurrentPrice, even if the dependency is indirect, as in the grand total.  So, I am going with the look-up field.

Thanks for your help!
0
 
LVL 28

Expert Comment

by:lesouef
ID: 17985566
> but only if you "tickle" it first.
-----------
this has the same effect as re-entering the stock name, so it recalculates its value as for a new record; but do not rely on this as it is dependant on the field type in the layout: for instance tickling does not work on a regular field while it works for a popup menu. On top, making such a script for 100000 lines is gonna be lengthy...
and what you did is the way to do anyway, this is the whole purpose of "relookup field content"
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Problem: You have a hosted FileMaker database and users are tired of having to use Open Remote or Open Recent to access the database. They say, "can't you just give us something to double-click on rather than have to go through those dialogs?" An…
Having just upgraded from Filemaker 11 to Filemaker 12 over the weekend, we thought we would add some tips for others making the same move.  In general, our installation went without incident. Please note that this is not a replacement for Chapter 5…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question