Solved

Can I force a re-evaluation of calculated fields?

Posted on 2006-11-18
5
1,644 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

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…
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…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

617 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