Jump to content
Sign in to follow this  
Wayne Irvine

Calculation updates

Recommended Posts

I have a look up table of products with parameters such as style, size, colour etc and of course price.

In another table I have the items ordered which allows you to choose a style, size, and colour and looks up the price form the products table.

I achieve this calculation using a field which contains a concatenated string like this 'style-size-colour' in both tables and a relationship based on this field. I use this relationship to return the price.

It works the first time, but when I change one of the parameters the price is not immediately updated.

How do I force a refresh?

Share this post


Link to post
Share on other sites
29 minutes ago, Wayne Irvine said:

I achieve this calculation using a field which contains a concatenated string

Is this field a calculation field? Or is it a text field with auto-entered calculated value? If the latter, did you deselect the `Do not replace existing value` option?

P.S. This arrangement is not necessary; you can define the relationship to match on the three original fields directly (assuming you're using version 7 or higher).

P.P.S Please update your profile to reflect your version and OS.

Share this post


Link to post
Share on other sites

It is a calculation field.

On the Relationship, do you make multiple relationship string between the tables?

Profile updated.

Share this post


Link to post
Share on other sites
4 minutes ago, Wayne Irvine said:

It is a calculation field.

Well, I cannot reproduce your problem (see attached file). When you say you "change one of the parameters", you mean in the Items table, right? In the same table where the lookup field is defined?

CompoundLU.fp7

 

10 minutes ago, Wayne Irvine said:

On the Relationship, do you make multiple relationship string between the tables?

You just add multiple pairs of matchfields in the Edit Relationship window. Or drag between another pair of matchfields to add it to an existing relationship.

Share this post


Link to post
Share on other sites

I got the multiple field relationships working and if I change a field manually it updates just fine. Never knew that was possible.

And I converted my calculations to lookups so the values will remain even if I change the prices later. Thanks for that.

I have one field which is DurNo which is of a calculation. I have a drop down field which is a list of values from a separate table (durations). The values are '1 hour', '2 hours' and 'Half hour' and they have the corresponding values 60, 120, 30. So when you select '1 hour' for the Duration the DurNo recalculates to the corresponding value and I thought this would trigger a recalculation of the cost. No go.

I changed the duration calculation to a lookup as well and it seems to have resolved my problem. Still not really sure why dependent calculations don't update though.

Edited by Wayne Irvine

Share this post


Link to post
Share on other sites

There is an button in the 'Specify Calculation' dialog called 'Storage Options'. Within that you can select 'Do not store calculation results - - recalculate when needed'.

This may reduce performance, since you are telling FileMaker not to store the results, but it will force recalculation of your field whenever FileMaker needs to reference it. Try choosing that and see if it resolves your problem.

Share this post


Link to post
Share on other sites
4 hours ago, Wayne Irvine said:

So when you select '1 hour' for the Duration the DurNo recalculates to the corresponding value and I thought this would trigger a recalculation of the cost.

We don't know how cost is being calculated. In general, an unstored calculation will not trigger anything. If cost is a stored calculation, and you want it to recalculate when Duration is modified, you need to reference the Duration field in the cost formula.

BTW, an unstored calculation field that does nothing but copy the related Duration value is redundant; you can simply display the related field directly.

Share this post


Link to post
Share on other sites
On 03/03/2017 at 8:03 PM, rwoods said:

There is an button in the 'Specify Calculation' dialog called 'Storage Options'. Within that you can select 'Do not store calculation results - - recalculate when needed'.

I couldn't use this as it it based on a related field.

22 hours ago, comment said:

We don't know how cost is being calculated.

I will modify your example and see if I can demonstrate. Before I do, can you accept fmp12 files?

Share this post


Link to post
Share on other sites
21 hours ago, Wayne Irvine said:

can you accept fmp12 files?

I can't, but others can. Or just describe the setup in words.

Share this post


Link to post
Share on other sites
On 3/4/2017 at 10:40 AM, Wayne Irvine said:

I couldn't use this as it it based on a related field.

I will modify your example and see if I can demonstrate. Before I do, can you accept fmp12 files?

You can use an unstored calc on the left hand side of a relationship, not the right. Take RWoods' advice. It will work.

Wayne,

Just a bit of general advice: Try using multiple predicates, instead of concatenating in another field, and always look for the option of storing values rather than calculating them. With script triggers this has become far easier.

Edited by ShaunB
typo

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×

Important Information

By using this site, you agree to our Terms of Use.