fiveshorts Posted January 30, 2008 Posted January 30, 2008 Hi there. Could someone help me with a 'simple' math problem (never my strung suit)... I want to determine the best way to express the ratio between two ever-changing values A & B. Sometimes A >B and sometimes A I'd like to work it so that the lesser of the two values is shown as "1" in the ratio, thus: A>B becomes A:1 A A=B becomes 1:1 Grateful for any help -)
fiveshorts Posted January 30, 2008 Author Posted January 30, 2008 Thank you Comment, that was the calculation I was already using to determine what the ratio was, but how to display the result as a ratio. If A = 2 B = 1 your calculation returns simply "2" I'm trying to get it to return (display) "2:1" and if A = 1 B = 2 I'm trying to get "1:2" and if A = 8 B = 32 I'm trying to get "1:4" Thanks for your attention -)
David Jondreau Posted January 30, 2008 Posted January 30, 2008 I think he wants it in ratio format... A/Min(A; & ":" & B/Min(A;:
fiveshorts Posted January 30, 2008 Author Posted January 30, 2008 THAT'S what I needed! Thank you. Thank you. Thank you. That side of my brain never got past neanderthal, I'm afraid....
comment Posted January 30, 2008 Posted January 30, 2008 That should work, or in a slightly more efficient version: Let ( denominator = Min ( a ; b ) ; a / denominator & ":" & b / denominator )
fiveshorts Posted January 30, 2008 Author Posted January 30, 2008 Thanks again, comment. Forgive me, but with both formulas, when: A = 553.00 B = 10.97 return = "1:0" what am I missunderstanding... please -(
comment Posted January 30, 2008 Posted January 30, 2008 Hard to say - I am not able to reproduce this result. Can you post a sample showing this? (A simple file with just three fields would do.)
David Jondreau Posted January 30, 2008 Posted January 30, 2008 I don't know how you can get that result unless B is 0 and A is negative. What are A and B defined as?
fiveshorts Posted January 30, 2008 Author Posted January 30, 2008 Here's the calculation producing the 'wrong' ratio: Let ( denominator = Min ( ALL trades::Total dollars of winners ; ALL trades::Total dollars of losers ) ; ALL trades::Total dollars of winners / denominator & ":" & ALL trades::Total dollars of losers / denominator ) and attached is a file created as requested, where the darn thing works. So I'm doing something wrong in the original... ratio.fp7.zip
fiveshorts Posted January 30, 2008 Author Posted January 30, 2008 No, they're unstored calculation fields.
comment Posted January 30, 2008 Posted January 30, 2008 Well of course, the next question would be what do they calculate, and what's the relationship, but... why don't you examine each component in isolation - i.e. see what ALL trades::Total dollars of winners returns on its own, then: ALL trades::Total dollars of losers and then: Min ( ALL trades::Total dollars of winners ; ALL trades::Total dollars of losers ) I am sure somewhere along the way you'll see where it goes wrong. BTW, the result of calculation should be set to type Text.
fiveshorts Posted January 30, 2008 Author Posted January 30, 2008 ALL trades::Total dollars of winners returns: "$533.00" ALL trades::Total dollars of losers returns: "$10.97" Min ( ALL trades::Total dollars of winners ; ALL trades::Total dollars of losers ) returns: "$10.97" Let ( denominator = Min ( ALL trades::Total dollars of winners ; ALL trades::Total dollars of losers) ; ALL trades::Total dollars of winners / denominator & ":" & ALL trades::Total dollars of losers / denominator ) returns: "50.4010207801676996:1" and yet it should be 48.58:1? Sigh.
comment Posted January 30, 2008 Posted January 30, 2008 (edited) If something returns "$533.00", then it's likely to be a text string, not a number. EDIT: But that cannot be the real reason - in your example, Filemaker would convert them to numbers correctly. Edited January 30, 2008 by Guest
fiveshorts Posted January 30, 2008 Author Posted January 30, 2008 It's definitely a number, but with its "number format" set to $ currency with two decimal places... I've since removed that formatting, but the result stays the same.
comment Posted January 30, 2008 Posted January 30, 2008 Just to eliminate something - what do you get with: Let ( [ a = ALL trades::Total dollars of winners ; b = ALL trades::Total dollars of losers ; denominator = Min ( a ; b ) ] ; a / denominator & ":" & b / denominator )
LaRetta Posted January 31, 2008 Posted January 31, 2008 [color:purple]Hey, I'm learning here. If you think you are the only one, you would be wrong. If you think there are some who aren't learning, you would be correct. But it isn't because they know everything; it's because they close their minds and THINK they know everything. We ALL are learning here. It is not a sin; it is a blessing. Here's to the journey we ALL are on!! :beertime:
fiveshorts Posted January 31, 2008 Author Posted January 31, 2008 What about just winners/losers? Well, that too returns 50.40102078 Which is nuts. I'd better call Filemaker and tell them I've got a dodgy copy... -(
fiveshorts Posted January 31, 2008 Author Posted January 31, 2008 Sometimes, stuck here in this room on my own, day after day, I feel like the only one who's EVER struggled with this program... -)
David Jondreau Posted January 31, 2008 Posted January 31, 2008 What about (in a text field) winners & " " & losers & " " & winners/losers?
fiveshorts Posted January 31, 2008 Author Posted January 31, 2008 What about (in a text field) winners & " " & losers & " " & winners/losers? OK, that returns a crazy 55310.97250.4010207801676996 ?
comment Posted January 31, 2008 Posted January 31, 2008 Something doesn't fit here. I suspect your first test wasn't done correctly. Please go into the SAME calculation field where the entire formula lives, and change it to: Let ( [ a = ALL trades::Total dollars of winners ; b = ALL trades::Total dollars of losers ; denominator = Min ( a ; b ) ] ; a ) Note the result, then change the formula to: Let ( [ a = ALL trades::Total dollars of winners ; b = ALL trades::Total dollars of losers ; denominator = Min ( a ; b ) ] ; b ) and finally: Let ( [ a = ALL trades::Total dollars of winners ; b = ALL trades::Total dollars of losers ; denominator = Min ( a ; b ) ] ; denominator ) Please report these three results.
fiveshorts Posted January 31, 2008 Author Posted January 31, 2008 I'm going to go back and rebuild the dependancies that lead me to A & B, 'cos obviously something's not right at this end and I don't want to keep wasting your time with my inane floundering around. I'll be back...
comment Posted January 31, 2008 Posted January 31, 2008 Are you aware of the fact that a reference to a related field returns the value from the FIRST related record?
LaRetta Posted January 31, 2008 Posted January 31, 2008 Why not give Comment what he has asked? He has taken the time to request it to help you? He can probably give you the answer right now!
comment Posted January 31, 2008 Posted January 31, 2008 He can probably give you the answer right now! LOL, don't make promises I'd have to keep. The truth is I have no idea what's going on here, only a vague suspicion.
LaRetta Posted January 31, 2008 Posted January 31, 2008 I don't care. You gave three tests!! Those tests will probably provide answers!! How difficult is it to simply follow instructions? Much simpler than taking something back home and re-hashing, re-thinking, re-doing the darned thing, no? What is to lose?
comment Posted January 31, 2008 Posted January 31, 2008 What is to lose? The sense of excitement of figuring it on your own, the learning experience ... I'd think you would be the first one to understand that: "The Journey's the Thing!!"
AudioFreak Posted January 31, 2008 Posted January 31, 2008 I totally agree. I find that when I run into a serious problem that takes me awhile to solve. It is that much more gratifying to get it working. Also what was causing it seems to stick in my head more....lol. The OP will prob post tomorrow "YAY I figured it out" Michael.
fiveshorts Posted January 31, 2008 Author Posted January 31, 2008 (edited) As soon as I posted that, we suffered a 2hr neighborhood power outtage... I had every intention of performing the three "tasks" AND trying to work backwards to see where the error lies at my end. How difficult is it to simply follow instructions? Have I not been polite enough? I thought I had. Edited January 31, 2008 by Guest
LaRetta Posted January 31, 2008 Posted January 31, 2008 (edited) How difficult is it to simply follow instructions? It was not my intent to be rude! It's just that I see many people on Forums ask for help and then give up too soon. All the while, someone here has spent time coming up with a solution (or really putting time into helping them solve it) and the answer is right here if they would have stuck it out one more moment. I thought you were leaving and I was trying to QUICKLY say, "Hey wait! We may have something which will help you solve it." And Comment has listed the steps out very specifically and it should give some inkling as to the problem. Yes. I know the power of solving things myself. But I also know how it feels when one has solved something and placed it before someone here ... only to have them say (usally without even looking at it), "well, I trashed it and I don't care what the answer is." True, either way, I win ... because *I* learned from the experience. But unless I help the other person who has ASKED for help, something feels lacking. If the OP would have wanted to figure it all out themselves, they wouldn't have posted in the first place. So yes, I understand working through things. And I also understand that, when I ask for help, it's because I usually want help. So, fiveshorts, please accept my apology for my tone. I was only trying to help you quickly before you left. :crazy2: Edited January 31, 2008 by Guest Changed some wording
Recommended Posts
This topic is 6201 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