Solved

Can I force a re-evaluation of calculated fields?

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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…
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

734 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