Jump to content

calculation causes circular definition?


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

Recommended Posts

Hello,

An apparent simple thing causes me some headache; I have following 3 fields: "COST", "DISCOUNT" and "DISCOUNT IN %"

I want to either enter a $$ amount into field "DISCOUNT" and then get the percentage result of that $$amount related to "COST",

OR enter a % amount into field "DISCOUNT IN %" and then receive the $$ amount in field "DISCOUNT".

What I did:

enter calc for "DISCOUNT" = ("COST" * "DISCOUNT IN %") ./.100 and

enter calc for "DISCOUNT IN %" = ("DISCOUNT" ./. "COST")*100

When I do this I get the message that this would cause a circular definition after I enter the second calculation. Is there any way around this?

Thanks,

Andy

Link to comment
Share on other sites

The easiest fix is to have two sets of fields and then stack them. Have two regular number fields for discount and Discount In %, and then two calculated display fields cDiscount and cDiscount In %

calc for "cDISCOUNT" = case(isempty(DISCOUNT), (COST * DISCOUNT IN %) /100, DISCOUNT)

calc for "cDISCOUNT IN %" = case(isempty(DISCOUNT IN %)(DISCOUNT / COST)*100,DISCOUNT IN %)

Set the field options for the calculated fields to NOT allow entry, and then stack the calculated fields over top of the entry fields. The display fields will show the calculated value, but when you click on them you will actually be entering/editing data in the entry field underneath.

Link to comment
Share on other sites

This topic is 7004 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.