lonesomejubilee Posted November 16, 2004 Posted November 16, 2004 Hey, I have two fields, one that you enter a dollar amount, and one that categorizes it. I want to make it so if you choose "zero" or whatever from the drop down list of categoriies, then it automatically places the amount "$0.00" in the dollar amount field (and locks you out).... and if you choose something else you can place a new dollar amount... how do I do this? Thanks
Dan-A Posted November 17, 2004 Posted November 17, 2004 There is an event plug-in (free) that would let you run a script as you exit the category drop down... You could run a sript that freezes the window, sets the amount field to $0.00 and switches layout to an identical layout, but in this one select field behavior & uncheck the access to the amount field. Dan
MoonShadow Posted November 17, 2004 Posted November 17, 2004 There are several ways to handle this, including validation and Extended Privileges. You have FM7 and a plugin isn't necessary here at all. The simplest way is this: Set your Amount field to Auto-enter calculation of: If(Category = "Zero"; 0; Amount). Be SURE to unclick the box (auto-enter tab) under calculated value 'Do not replace existing values.' In this way, if a User selects Zero from popup, the amount will display 0. Users can change it if they wish BUT ... it won't matter because it will immediately change back to 0 as soon as they leave the field. If your popup displays anything else, the amount can be changed and will stay changed -- until they again change the popup to zero. I think this is friendlier than using validation or extended privileges because it eliminates that unsettling FM error message. I prefer to simply fix it for them.
Dan-A Posted November 17, 2004 Posted November 17, 2004 i also think your version is friendlier even if it does not "lock" the user out.
lonesomejubilee Posted November 17, 2004 Author Posted November 17, 2004 It works like a charm... thanks..
lonesomejubilee Posted November 17, 2004 Author Posted November 17, 2004 Oh, one other thing.... how do I do that for multiple conditions (add a second if statement)?
MoonShadow Posted November 17, 2004 Posted November 17, 2004 It depends upon what you wish to accomplish. A few examples, expanding on the original of If(Category = "Zero"; 0; Amount) If(Category = "Zero" or DifferentText = "Yes"; 0; Amount) If(Category = "Zero" or not IsEmpty(DifferentText); 0; Amount) If(Category = "Zero" and DifferentNumField < 3; 0; Amount) If this doesn't do it for you, let us know the specifics and we'll give you the calc. If you want your Amount field to contain more than two possible results, you'll have to switch to a Case() or Choose() calculation.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now