Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Can I force a re-evaluation of calculated fields?

Posted on 2006-11-18
5
Medium Priority
?
1,651 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 1000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

664 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