Angelo Spiler Posted September 21, 2003 Posted September 21, 2003 This must have been an issue before, but can't find the solution. I have a calculation field (working hours x price/hour) but want to have the ability to overrule the outcome for this field. So actually I want to set new data in this calc. field. But as you may know, this is not possible with calc. fields. How can I make a solution for this. Tried lookup-fields, but don't think this is gonna work. [email protected]
Lee Smith Posted September 21, 2003 Posted September 21, 2003 Are you wanting to substitute a Price per hour or the total to be charge and override the current calculation? You can change the current calculation to charge a minimum amount or the price per hour x working hours, or you could make the price per hour flexible by using a pop up menu for that. Or you can use a bit of trickery. If you just want to substitute a total for the calculated one, then you will need to create another field (I called it "OptionPrice_Per_Hour" in my calculation below), but use any name you want and change it in the calculation. Then change the current calculation you have with this calculation: Case(IsEmpty(OptionPrice_Per_Hour), working hours * price_hour, OptionPrice_Per_Hour) Note: I not sure if you actually used "/" in the name of price/hour, but that is an operator and should be changed if you did. the "_" works well, but there is nothing wrong with just a space either. On you layout, you will want to stack the new field on top of your current calculation field and make it transparent. Be sure that you make your current calculation does not allow entry by checking that box in layout mode and Field Format. HTH Lee
Angelo Spiler Posted September 21, 2003 Author Posted September 21, 2003 Thanks Lee, The last solution (with another field on top and transparant) is the one we have to deal with. I tried this already and works quite well. But there is one caveat: If somebody has already filled in the working hours ad the price_hour, then naturally the calc. field will show the result. If I then later override this calculation by entering my data in the new field on top, there are two fields on top of eachother showing data. I could of course empty the fields which result in the calc. data, but I hope there is a better solution. One that would do the following: on the moment I enter data in the field on top, the working hours and the price_hour are automaticcaly emptied, so the calc. field would be empty too. This saves me the time of manually remove the data in those fields. Do you have any idea this is possible (or a solution alike)?
Lee Smith Posted September 21, 2003 Posted September 21, 2003 Here is one way, maybe others can come up with a different on. I used two additional calc Fields that base the calculation on the Manual entry of the total being blank. It merely hide's the fields as with the calculation did. Crude sample attached PriceSubstitute.fp5.zip
Angelo Spiler Posted September 21, 2003 Author Posted September 21, 2003 Yes Lee, This is gonna do the job. Still have the idea (or better: wish) that there would be a more elegant solution, but as happy as I already am, I will implement this one. Thanks a lot.
Angelo Spiler Posted September 21, 2003 Author Posted September 21, 2003 Ah, one more little design issue. On selecting The Manual field, one sees all the entries in the modifiable fields (even when normally hidden by another field) which cannot be seen when you deselect the Manual field (Which is how it should be). I guess there's no way of the same appearance whether the manual field is selected or not.
Ugo DI LUCA Posted September 21, 2003 Posted September 21, 2003 Hi Angelo, Here are 4 methods I know of doing what you're trying to achieve. They all follow Lee's advices, but use some additional tricks for display purpose. Investigate and pick-up the one that fits your needs. One caveat though. In Find Mode, you'd always be drived to the "option" field, so you'd need another layout. HTH PriceSubstitute2.fp5.zip
Jim McKee Posted September 22, 2003 Posted September 22, 2003 Ugo ... Nice demo. You guys should know by now that I like scripts, and that I like to build validation routines to restrict data entry in critical fields as much as possible. "GIGO" So I toss this one into the ring. It uses a single, short script to switch back and forth between "Calculated" mode and "Override" mode, and does the housekeeping needed to clear fields, etc., and 2 field button scripts to prevent users from entering "hour" and "price per hour" data when an "override" total is being used. It will also restore the last set of "hour" and "pph" values if the user decides to switch back to "Calculated" mode. Lucky for you guys that I didn't build any validation or error checking routines into the scripts. I saved you the hours it takes to read my comments How I long for built-in "on-enter" and "on-exit" field actions in FM. Maybe in 7? Cheers! Calculated Total Override.zip
Angelo Spiler Posted September 22, 2003 Author Posted September 22, 2003 Thanks guys, the portal trick of Ugo is the best one that suits my needs. Especially the fact that one can't enter data in the price/working hours fields when I have overruled the calc. field is a bonus. As a newbie this will be a hell of a job to implement in my dbase, but I'll succeed in time.
Recommended Posts
This topic is 7803 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 accountSign in
Already have an account? Sign in here.
Sign In Now