Title
Multiplying by 0
Post
I have the following set variable script. The value of $setclassmultiplier is derived from a found set. There are occasions where the fields value in the found set is 0.
In later part of the script, i need to multiply the value of $setclassmultiplier to another value.
If the value is 0, that won't work.
I tried adding the statement... & Case ( $setclassmultiplier = 0 ; 1 ) to the bottom but when the value is 0 it does not change it to a 1.
Why?
Is it because it does not know its 0 until after the script has run? If so can i do another set variable under it with the case statement and will that work?
SetVarable [$setclassmultiplier ; value...
Case (
Rate Calculation::Classfromquote =50 ; Rate Calculation::Class50 ;
Rate Calculation::Classfromquote =55 ; Rate Calculation::Class55 ;
Rate Calculation::Classfromquote = 60 ; Rate Calculation::Class60 ;
Rate Calculation::Classfromquote = 65 ; Rate Calculation::Class65 ;
Rate Calculation::Classfromquote =70 ; Rate Calculation::Class70 ;
Rate Calculation::Classfromquote = 77 ; Rate Calculation::Class77 ;
Rate Calculation::Classfromquote = 85 ; Rate Calculation::Class85 ;
Rate Calculation::Classfromquote = 92 ; Rate Calculation::Class92 ;
Rate Calculation::Classfromquote = 100 ; Rate Calculation::Class100 ;
Rate Calculation::Classfromquote = 110 ; Rate Calculation::Class110 ;
Rate Calculation::Classfromquote = 125 ; Rate Calculation::Class125 ;
Rate Calculation::Classfromquote = 150 ; Rate Calculation::Class150 ;
Rate Calculation::Classfromquote = 175 ; Rate Calculation::Class175 ;
Rate Calculation::Classfromquote = 200 ; Rate Calculation::Class200 ;
Rate Calculation::Classfromquote = 225 ; Rate Calculation::Class225 ;
Rate Calculation::Classfromquote = 250 ; Rate Calculation::Class250 ;
Rate Calculation::Classfromquote = 300 ; Rate Calculation::Class300 ;
Rate Calculation::Classfromquote = 400 ; Rate Calculation::Class400 ;
Rate Calculation::Classfromquote = 500 ;Rate Calculation::Class500 ;
)
&
Case ( $setclassmultiplier = 0 ; 1 )
Use this separate from the calculation. The variable won't have this value until after the script step executes:
Set variable [$setclassmultiplier ; value... Case (...]
Set Variable[$setclassmultiplier ; value: If ( $setclassmultiplier ; $setclassmultiplier ; 1 ) ]
Note: any non-zero value for $setclassmultiplier will evaluate as True in the If function that I am using. You can use case instead of If if you like. I used this code so that if $setclassmultiplier is empty, it would also receive a value of 1.
Note: instead of such a complex Case function that "hardwires" these values into your script, I'd use a table of these values and set up a system to lookup the desired values for this variable from the table. This way, a user can update the values used here without having to be a fileMaker developer, the update process can instead be a simple data editing task on a layout in your database.