Announcement

Collapse
No announcement yet.

Nevermind... Found some code...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Originally posted by Boleslav
    How about trying to define a field as the average of the high and low trivial, but treating items with only one end point as if that endpoint were the average. It might look something like this:

    IF(lo<>"?" AND hi<>"?", (hi+lo)/2, IF(lo="?",hi,lo))

    This is a nested IF like you might use in Excel. IF(condition, true part, false part)

    This would take the average of the high and low trivials if both existed. In cases with just one endpint, it will take that value.

    For the set of data you provided, it would sort them as follows:

    Low High Displayed Trivial
    20 20 20
    ? 50 <50 (it will think of it as 50)
    75 75 75
    70 80 70<=x<=80 (it will think of it as 75)
    85 ? >85 (it will think of it as 85)
    90 90 90

    Boleslav Foregehammer
    Paladin of Brell in his 61st Campaign
    E'ci – Sacred Destiny
    soundsok... EXCEPT when we know low and high... so the trivial range is big, then it may not fit in its logical place anymore. I only gave a small numberset... but say..

    20 20 = 20
    10 30 = 20
    90 90 = 90
    10 190 = 100
    110 110 = 110

    so your order would be
    20
    10<=x<30
    90
    10<=x<190
    110


    so to me that 10 - 190 is out of place...

    That is why it seems to me there is no good answer here :/
    Ngreth Thergn

    Ngreth nice Ogre. Ngreth not eat you. Well.... Ngreth not eat you if you still wiggle!
    Grandmaster Smith 250
    Master Tailor 200
    Ogres not dumb - we not lose entire city to froggies

    Comment


    • #17
      Ngreth,
      I have sent you some MySQL code that should allow you to display the trivial values, in text form, sorted by the highest known trivial WITHOUT the use of IFs. This code should allow you to list the items in the order you want and even comes with a 'No Trivial' if both fields are not known (just in case there are rumored recipies)

      Please take a look at it and let me know if you have any questions.

      I'll be waiting,
      Kylanna

      Comment


      • #18
        I think I have some code that will work (I did not know how if's work in MySQL... so I was given some code that should work... better.)

        I am gonna close this one and just use the code I have been given.

        Thanks for all the sugestions!!
        Ngreth Thergn

        Ngreth nice Ogre. Ngreth not eat you. Well.... Ngreth not eat you if you still wiggle!
        Grandmaster Smith 250
        Master Tailor 200
        Ogres not dumb - we not lose entire city to froggies

        Comment

        Working...
        X