Can’t use the GetField function to insert the field’s numerical value into a calculation formula.

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

Recommended Posts

Operating system is Windows XP

Filemaker product is Filemaker 8.5 Advanced

I want to calculate the Retail Price from the Wholesale Price using Markups based on ranges from a set of global number fields.

Let’s say the Wholesale price is \$0.25. It is contained in a repeating number field that is calculated from Quantity x Unit Price. The retail price field is also a repeating field with the same number of repetitions.

The Markup percentage for this price would be based on the Global Field “From” and the Global Field “To” both of which are number fields. The field that holds the markup percentage will be called “Markup” it to is Global.

Let’s say that “From” is \$0.01 and “To” is \$0.50

If I use the formula for “Retail”

If (Wholesale => .01 and Wholesale =< .50;Wholesale*2;””)

It calculates just fine.

Unfortunately the list of Froms and Tos and Markups need to be modified from time to time and I do not want to have to edit the calculation field to enter new numbers there.

If I use the formula for “Retail”:

If (Wholesale => GetField(From) and Wholesale =< GetField(To);Wholesale * GetField(Markup);””)

It sets the retail to empty. In other words GetField(From) did not become .01 and GetField(To) did not become .5 etc.

If I create a calculation field (repeating or not) to equal GetField(From) it shows .01 the GetField(To) also works alone.

What am I doing wrong?

Share on other sites

GetField() is not needed here. The fields (From and To) can be used directly in a calculation. Since you're using them in a repeating calc, you'd need to use the Extend() function to get each value to apply to each repetition.

BTW: You should look into using a related Line Items table for this rather than using repeating fields.

Share on other sites

Perfect!

I had used it without the GetField but my first Wholesale price was outside the test range so I kept getting nothing.

The extend function was something I was not even aware of.

Thanks,

EMP

Share on other sites

This topic is 5605 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