November 1, 200322 yr I have two fields. The first contains either a "+" or "-" sign, selected from a value list. The second contains a positive number with two decimal places. If the user selects "-" in the first field and enters 2.25 in the second field, then I would like a calculation to return "-2.25" as a rational number that I could use in a separate calculation. Conversely, If the user selects "+" in the first field and enters 2.25 in the second field, then I would like the calculation to return "+2.25" (or just "2.25"). Another problem that I've come across is that if I put a "-" sign in a value list, Filemaker 6 returns a separator instead of a minus sign. I've resorted to an "em dash" in the value list, but I'm not sure if it will be interpreted as a minus sign in subsequent calculations. Thanks for your suggestions! Jason
November 1, 200322 yr It would be easier to use "pos"/"neg" than "+"/"-". See attachment for possible solution. Calc.zip
November 2, 200322 yr Hi Jason, I guess there are a few different ways you could approach this. Attached is yet another alternative that you might like to consider. Calc.zip
November 3, 200322 yr Author It turns out this problem is more tricky than I first described it. This is for eyeglass prescriptions. I now realize that I should not have a separate plus/minus field, as I mistakenly indicated earlier. The various eyeglass power measurements are recorded in number fields. As expected, negative numbers have a minus sign. Convention requires that positive numbers have a plus sign in front of them. No problem until I add two of these positive numbers together (as when calculating the strength of reading glasses); then I get a positive number without a positive sign. It turns out opticians can't make heads or tails of this result. So I need to add together two positive numbers which have a plus sign in front of them, and have the result contain a plus sign. (Alternatively, if the patient is myopic, and the sum is negative, then the result should have a minus sign -- but Filemaker does this). Put more simply, if an arithmetic sum is positive, the result should have plus sign. Also, the result must have two places after the decimal point. Seems simple enough, but I can't figure it out. Thanks for your help. I've posted an attachment to illustrate this problem. Jason Trial.fp5.zip
November 3, 200322 yr The calculation's result must be of type "text" to make it work: Case((a+:>0, "+" &( a+:, (a+: For setting number of decimals see this thread Dj
November 3, 200322 yr Author Thanks djgogi, Your calc eliminates the need for a script. I looked at the thread that you recommended and it left my head spinning. I really could use some help on this one. I've update my example problem, using your calc, and expanded the value lists to contain all the realistic numbers that this calc would use. Thanks again, Jason Trial2.fp5.zip
Create an account or sign in to comment