Page 1 of 1

One line of code needed...

Posted: Fri Jun 10, 2016 1:48 pm
by RossG
I have:

Code: Select all

   repeat with x = 16 to min(36,sCount)
      put max(field ("R" & x),field ("B" & x)) into maxVar
      put min(field ("R" & x),field ("B" & x)) into minVar
      if round(maxVar/minVar,2) > mPerCent then
         put round(maxVar/minVar,2) into mPerCent
         ---
      end if
   end repeat
In the line "---" I want to get the name of the field
containing the max value.

No prize for the correct answer but lots of gratitude from
a tired old brain.

Re: One line of code needed...

Posted: Fri Jun 10, 2016 3:37 pm
by dave.kilroy
Hi - the following appears to work (the field name you want is in 'tMax & x') but it does make other changes to your code...

Code: Select all

    repeat with x = 16 to min(36,sCount)
        if fld ("R" & x) > fld ("B" & x) then put "R" into tMax else put "B" into tMax
        put round(fld (tMax & x)) into maxvar
        put min(field ("R" & x),field ("B" & x)) into minVar
        if round(maxVar/minVar,2) > mPerCent then
            put round(maxVar/minVar,2) into mPerCent
            ---
        end if
    end repeat
Note: this doesn't allow for occasions where fld ("B" & x) is equal to fld ("R" & x)

Re: One line of code needed...

Posted: Mon Jun 13, 2016 11:28 pm
by RossG
Thanks Dave.

I like min and max. Both remind me of people.
Minnie was my mothers middle name - well, it was 1912.
Although Minnie Driver doesn't seem to suffer from it.

Max was just funny. That was around 1950. Don't
expect that he's very funny these days.