Another flow control question

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

  • Another flow control question

    Good Morning.

    I have a porblem where I have to output a integer depending on an outcome of a calculation.
    The integer will depend on where it lies between a range of dimensions as seen below.

    For example:
    (Integer)
    1 = +0.0061 to +0.020
    2 = +0.002 to 0.006
    3 = -0.002 to +0.0019 and so on

    Coding is NOT my strongest asset so would anybody be so kind as to point me in the right direction?! (Not over the cliff)

    Virgil
    Bristol Citysigpic
    Home of the Reds

  • #2
    use the IF statement in an assignment, BUT, I need to know where this interger is coming from... This example uses the X axis deviaiton
    Code:
                  ASSIGN/V1 = IF(AND(DE010.X.DEV>0.0061,DE010.X.DEV<0.02),1,0)
    that will assign V1 to 1 if the X axis deviation in the dimension DE101 is greater than 0.0061 and less than 0.020 or 0 if not.
    Do this for each 'grouping'. Do an assignment array, find the maximum. If each is set to be zero if it fails, then the maximum will be the 1, 2, or 3 that you are looking for.
    sigpic
    Originally posted by AndersI
    I've got one from September 2006 (bug ticket) which has finally been fixed in 2013.

    Comment


    • #3
      Dang it, it shows "green" for the code, but it is not returning the proper values. checking it....
      sigpic
      Originally posted by AndersI
      I've got one from September 2006 (bug ticket) which has finally been fixed in 2013.

      Comment


      • #4
        Thanks Matthew, that will work. The integer will come from a vatiable so all I will have to do is swap x.dev with the variable.
        I believe this works, somehow! Purely by luck on my part!

        IF/T4>0.0061
        ASSIGN/T4=1
        END_IF/
        ELSE_IF/T4>0.0011
        ASSIGN/T4=2
        END_ELSEIF/
        ELSE_IF/T4>-0.004
        ASSIGN/T4=3
        END_ELSEIF/
        ELSE_IF/T4>-0.009
        ASSIGN/T4=4
        END_ELSEIF/
        ELSE_IF/T4>-0.014
        ASSIGN/T4=5
        END_ELSEIF/
        ELSE_IF/T4>-0.050
        ASSIGN/T4=6
        END_ELSEIF/
        Bristol Citysigpic
        Home of the Reds

        Comment


        • #5
          Originally posted by Virgil UK View Post
          Thanks Matthew, that will work. The integer will come from a vatiable so all I will have to do is swap x.dev with the variable.
          I believe this works, somehow! Purely by luck on my part!

          IF/T4>0.0061
          ASSIGN/T4=1
          END_IF/
          ELSE_IF/T4>0.0011
          ASSIGN/T4=2
          END_ELSEIF/
          ELSE_IF/T4>-0.004
          ASSIGN/T4=3
          END_ELSEIF/
          ELSE_IF/T4>-0.009
          ASSIGN/T4=4
          END_ELSEIF/
          ELSE_IF/T4>-0.014
          ASSIGN/T4=5
          END_ELSEIF/
          ELSE_IF/T4>-0.050
          ASSIGN/T4=6
          END_ELSEIF/
          Ah, yes, using the lower limit of the highest grouping as the first "if" and branching if true, then the next lower, and the next and the next, YEP, I do that in Excel all the time. I was trying to get it 'cleaned' up into 4 lines of code.
          Sort of like this Excel code:
          =IF(CJ4<CL4,CL3,IF(CJ4<CM4,CM3,IF(CJ4<CN4,CN3,IF(C J4<CO4,CO3,IF(CJ4<CQ4,CP3,IF(CJ4<CR4,CQ3,IF(CJ4<CS 4,CR3,IF(CJ4<=CT4,CS3,CT3))))))))
          Surprisingly, a lot of Excel code WILL work in Pcdmis, at least the format. Of course, cell callouts won't work, but if they are swapped with assignment labels.
          sigpic
          Originally posted by AndersI
          I've got one from September 2006 (bug ticket) which has finally been fixed in 2013.

          Comment

          Related Topics

          Collapse

          Working...
          X