Solved

Can I force a re-evaluation of calculated fields?

Posted on 2006-11-18
5
1,596 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Pop up windows can be a useful feature of any Filemaker database.  Though best used sparingly, they can be employed in a multitude of different ways, for example;  as a splash screen at login, during scripted processes to control user input, as pick…
Conversion Steps for merging and consolidating separate Filemaker files The following is a step-by-step guide for the process of consolidating two or more FileMaker files (version 7 and later) into a single file with multiple tables. Sometimes th…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now