Jump to content

Calculation fields options


This topic is 7213 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi,

In my solution I have two fields labeled "Alc percent" and "Alc Proof". Originally, I had the "Alc Percent" field as a simple calc "Alc Proof / 2". However, I would like to allow the user to enter data into either Field. If "alc Proof" is entered then the "alc percent" field calculates "Alc Proof / 2". If "alc percent" is entered then "Alc Proof" calculates "alc percent * 2". Can I do this with just calcs and not use scripts and globals? I have tried auto enter calc replacing existing data but it only works when I change the "alc proof" value. If I change the "alc percent" value, it reverts back to the "alc proof / 2".

Link to comment
Share on other sites

This would need to be a scripting function, correct? I am hoping to just use field calculations to do it. I was trying to figure a way to use the example plug-in from Dev 7 to trigger a script when the field is exited, but I don't think I can pass a parameter based on which field is used

Link to comment
Share on other sites

Make both calculations numbers with an auto-enter calculation.

Alc Percent := Case( Get(ActiveFieldName) = "Alc Proof"; Alc Proof / 2; Alc Percent )

Alc Proof := Case( Get(ActiveFieldName) = "Alc Percent"; Alc Percent * 2; Alc Proof )

Deselect 'Do not replace existing value for field' checkbox on both fields.

Link to comment
Share on other sites

I never thought this possible, but yes:

You can do it doing field auto enter calculation only.

FileMaker 7 amazes me ervery day ....

alc proof =

If(

not IsEmpty(alc percent) and (Get(ActiveFieldName)= "alc percent" );

alc percent * 2;

alc proof)

alc percent =

If(

not IsEmpty(alc proof) and (Get(ActiveFieldName)= "alc proof" );

alc proof / 2;

alc percent)

see attached sample

BTW,, foreigners, you can copy the English calc formulas if you use a copy of FileMaker 7 with all other languages removed. (at least in MacOS X). Both copies can be used at the same time....

Pasting English formulas works in Native language version, they will be automatically translated.

I always type the English Right() and Middle() functions instead of German ZeichenRechts(), ZeichenMitte() in my German language FileMaker... and let() instead of SetzeVars().

alc.fp7.zip

Link to comment
Share on other sites

The Get(Active...) functions do not always update properly when used in calculations. I believe they were meant for scripts. There may be times you'll need to change layouts for them to change or modify a field (which you are doing). So it may work in this instance because you are referencing a field being changed (?) but I've had them fail to update on me when used in calculations. crazy.gif

Similarly, and for the same reasons, an Auto-Enter (Replace) using a Get(Active...) function may not be reliable? I will have to play with this whole concept and test all of this further. Thank you Queue! This is a wonderful eye-opener for me too! Oh yes, FM7 blows my mind (and humbles me) on a daily basis. I've 'restyled' one TOG 15+ times already ... each time taking further advantage of the power of 7 and eliminating 'old style' thinking. The wonders of 7 never end. smile.gif

Link to comment
Share on other sites

This topic is 7213 days old. Please don't post here. Open a new topic instead.

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
×
×
  • Create New...

Important Information

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