November 16, 200421 yr 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
November 17, 200421 yr 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
November 17, 200421 yr 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.
November 17, 200421 yr i also think your version is friendlier even if it does not "lock" the user out.
November 17, 200421 yr Author Oh, one other thing.... how do I do that for multiple conditions (add a second if statement)?
November 17, 200421 yr 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.
Create an account or sign in to comment