Flow Control

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

  • Flow Control

    Fellas, I am trying to get a diameter passed into my program via flow control and I am trying a new approach. Can you look at my code and tell me my problem?
    Thanks
    VERSION =COMMENT/INPUT,YES,'IS THIS TWIN CRANKCASE VERSION 24560...
    ,
    ,1. 13?
    ,2. 17?
    ,3. 35?
    ,4. 52?
    ,'
    IF/VERSION.INPUT==1
    ASSIGN/SLEEVE_DIAMETER = 73.9
    should I have an end/if in here?
    ELSE_IF/VERSION.INPUT==2
    ASSIGN/SLEEVE_DIAMETER = 75.00
    ELSE_IF/VERSION.INPUT==3
    ASSIGN/SLEEVE_DIAMETER = 78.00
    ELSE_IF/VERSION.INPUT==4
    ASSIGN/SLEEVE_DIAMETER = 85.00
    END_ELSEIF/
    sigpic

    James Mannes

  • #2
    Originally posted by JamesMannes View Post
    should I have an end/if in here?
    Yes also you need END/ELSE after each ELSE_IF test. I think..........
    <internet bumper sticker goes here>

    Comment


    • #3
      I think I got with this...
      VERSION =COMMENT/INPUT,YES,'IS THIS TWIN CRANKCASE VERSION 24560...
      ,
      ,1. 13?
      ,2. 17?
      ,3. 35?
      ,4. 52?
      ,'
      IF/VERSION.INPUT==1
      ASSIGN/SLEEVE_DIAMETER = 73.9
      GOTO/TESTER
      END_IF/
      IF/VERSION.INPUT==2
      ASSIGN/SLEEVE_DIAMETER = 75.00
      GOTO/TESTER
      END_IF/
      IF/VERSION.INPUT==3
      ASSIGN/SLEEVE_DIAMETER = 78.00
      GOTO/TESTER
      END_IF/
      IF/VERSION.INPUT==4
      ASSIGN/SLEEVE_DIAMETER = 80.00
      GOTO/TESTER
      END_IF/
      sigpic

      James Mannes

      Comment


      • #4
        Or use select case. You might want to test for junk input too.
        <internet bumper sticker goes here>

        Comment


        • #5
          I like case better for this type of flow. It just seems easier to manage. Isnt there a case else for "junk"
          Unless "TESTER" is not directly below the if/thens, you can delete all of the GOTOs
          Links to my utilities for PCDMIS

          Comment


          • #6
            Yes case else would be appropriate for junk. Always got to be anticipating monkeyspeak.
            <internet bumper sticker goes here>

            Comment


            • #7
              Case else will do what allow me to throw them a message about using 1,2,3,4? Show me?
              sigpic

              James Mannes

              Comment


              • #8
                Use select case to evaluate each condition that you have in your example. Then use a case else to evaluate a condition that is undesireable such as instead of entering a 1, or 2, or 3, or 4 the operator enters the word "clownpoop" what will you do then. Case else evaluates anything that is not in one of your previous case arguments.
                <internet bumper sticker goes here>

                Comment


                • #9
                  Monkeyspeak and clownpoop. New terms to me.

                  But don't stop, I'm learning something from this thread I think I can use.
                  When in doubt, post code. A second set of eyes might see something you missed.
                  sigpic

                  Comment


                  • #10
                    Could you use a small script to have them select what option and put a variable right after the script to pass it to..

                    Function Main()
                    Begin Dialog Menu 192,45,140,115, "Main Menu",.enable
                    OptionGroup .GROUP_1
                    OptionButton 32,16,68,12,"Operator Run",.choice1
                    OptionButton 32,28,68,12,"9",.choice2
                    OptionButton 32,40,68,12,"10",.choice3
                    OptionButton 32,52,68,12,"11",.choice4
                    OptionButton 32,64,68,12,"12",.choice5
                    OKButton 8,88,48,16
                    CancelButton 64,88,64,16
                    End Dialog

                    Dim app As Object
                    Set App = CreateObject("pcdlrn.Application")

                    Dim part As Object
                    Set Part = App.activePartProgram

                    Dim cmds As Object
                    Dim cmd As Object

                    Dim dlg1 As Menu
                    button = Dialog( Dlg1 )

                    Dim sel_text As String

                    If button = -1 Then
                    'comment MsgBox "button:" & button ' uncomment For button return value
                    Select Case Dlg1.GROUP_1
                    Case 0
                    sel_text = "Operator Run"
                    Case 1
                    sel_text = "9"
                    Case 2
                    sel_text = "10"
                    Case 3
                    sel_text = "11"
                    Case 4
                    sel_text = "12"
                    End Select
                    Else
                    MsgBox "Cancel was Pressed"
                    End If

                    Set cmds = part.Commands
                    'comment Get the assignments command
                    For Each cmd In cmds

                    If cmd.TypeDescription = "Assignment" Then
                    bln = cmd.PutText("""" + sel_text + """",SRC_EXPR,0)
                    cmd.ReDraw
                    End If

                    Next cmd

                    End Function
                    sigpic
                    if you had soap on a rope it would be tied to yer ankle

                    Comment


                    • #11
                      I am going to post over in the code section also. This is how I ended up...


                      VERSION =COMMENT/INPUT,YES,'IS THIS TWIN CRANKCASE VERSION 24560...
                      ,
                      ,1. 13?
                      ,2. 17?
                      ,3. 35?
                      ,4. 52?
                      ,'
                      SELECT/VERSION.INPUT
                      CASE/1
                      ASSIGN/SLEEVE_DIAMETER = 73.8
                      END_CASE/
                      CASE/2
                      ASSIGN/SLEEVE_DIAMATER = 76.9
                      END_CASE/
                      CASE/3
                      ASSIGN/SLEEVE_DIAMETER = 79.9
                      END_CASE/
                      CASE/4
                      ASSIGN/SLEEVE_DIAMETER = 79.9
                      END_CASE/
                      DEFAULT_CASE/
                      COMMENT/OPER,NO,INCORRECT VALUE INPUT FOR VERSION NUMBER
                      GOTO/ENDO
                      END_DEFAULTCASE/
                      END_SELECT/
                      Thanks to craiger and J for the help.
                      Last edited by JamesMannes; 02-13-2007, 04:16 PM.
                      sigpic

                      James Mannes

                      Comment

                      Related Topics

                      Collapse

                      Working...
                      X