Robbydobbs Posted March 4, 2003 Posted March 4, 2003 I have the following script setup and I cannot not get it to multiply when it is needed. If (rate_code = "2") Set Field Commission, Case(Price <= 400, "50", Price > 400 and Price <= 1000, "100", "150") Else If (rate_code = "3") Set Field Commission, Case (Price < 200, " Price * .50", Price >= 200 and Price < 1000, "100", Price >= 1000 and Price <= 2000, " Price * .10",
Lee Smith Posted March 4, 2003 Posted March 4, 2003 Hi Dobbers, Why Script it, you can do this with a calculation and two fields. Commission number result = Case(Price < 200, 50, Price <= 1000, 100, Price > 1000 , 150) HTH Lee
LaRetta Posted March 4, 2003 Posted March 4, 2003 Hi Dobbers Your fields weren't enclosed in "" as they normally would display but your 'results' were ("100"), so I'm unsure ... but I think you may be typing "" in the Calculation Setup box? If your Price and Commission fields are number (and I assume they are), then FM is interpreting your "Price * .50" as text. "" would still work when Setting a number because FM will place text in a num field, but you can't use 'text' in a num field calculation If [ Rate_Code = 2 ] Set Field [ Commission, Case(Price <= 400, 50, Price <= 1000, 100, 150) ] Else Set Field [ Commission, Case(Price < 200, Price * .50, Price <= 1000, 100, Price <= 2000, Price * .10, 200)] End If I noticed an inconsistency in your use of <= 1000 between Rate_Code 2 and 3 but your result (100) was the same. Was there an error in your original post or did you want that? IF so, you'll need to correct my Rate_Code 3 <= 1000 to <= 999. You don't need to list the Rate_Code = 3 at the start of your Else statement because all remaining records (that aren't Rate_Code 2) will be Rate_Code 3 (they are the Else result). So there is no reason to require FM to use processor cycles to check the Rate_Code field at this late point in the script step. I think it's a bit simpler. So lose the "", correct the script and it should work fine. I don't question why you are using a script. Only you know your solution and I assume you have reasons for scripting this data. I hope this solved your problem. LaRetta
Lee Smith Posted March 5, 2003 Posted March 5, 2003 The answer I submitted was based on your last sentence of your post. However, after reading the post again, I see you had a second break point. Here is an ammended calculation that will do both. Case( rate_code = 2 and Price <= 400, 50, rate_code = 2 and Price <= 1000, 100, rate_code = 2 and Price > 1000, 150, rate_code = 3 and Price < 200, 50, rate_code = 3 and Price <= 1000, 100, rate_code = 3 and Price > 1000, 150 ) HTH Lee
Robbydobbs Posted March 5, 2003 Author Posted March 5, 2003 Thanks Lee, I think that is the answer I was looking for. I appreciate your feed back. Robbydobbs
Newbies Tony Cruz Posted April 17, 2003 Newbies Posted April 17, 2003 When printing,FM doesn't print to the default printer. How can I correct this problem? Also, Change Order: When printing, it defaults to Records Being Browsed instead of Current Record. How do I fix this problem?
batgirl003 Posted April 17, 2003 Posted April 17, 2003 That is in your print settings. You state whether or not you want the file to records being browsed or the current record. Is this print setting in your script? Make sure when you tell it to do this print command in your script that you have the correct printed selected at the time the script is written with the right settings.
Recommended Posts
This topic is 7895 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