hexagon logo

Reading a Value from a .txt file and display in operator comment

Having some trouble figuring this out. I have a .txt file with a number 1-9 in it and I want PcDmis to read the file, read the number and use it an an assignment V2. If the number is greater than 5 go to a operator comment and if its not true, go to another operator comment.

The code works but my if_goto isn't working. Also when I highlight over the variables, my cursor shows 0 (zero). So if the value is 6 it should say display the true operator comment and if its 4 it should display the not true operator comment but it always says true even though the number is less than 5.

            ASSIGN/DATA1="C:\USERS\RENEGADE PRECISION\DESKTOP\TEST REPORTS\TEST.TXT"
FPTR       =FILE/OPEN,DATA1,READ
V1         =FILE/READ_BLOCK,FPTR,2
            FILE/CLOSE,FPTR,KEEP
            ASSIGN/V2=V1
            COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
            "value is "+V2[COLOR=#0000FF]<------op comment pops up with the correct value in the .txt file. I enter the value and save it manually in the file so this part works.[/COLOR]
            IF_GOTO/V2>5,GOTO = TRUE
TRUE       =LABEL/
            COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
            true
            GOTO/END
NOT_TRUE   =LABEL/
            COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
            not true
END        =LABEL/
Parents
  • Code-->

    I would do this
    ASSIGN/V2=V1
                ASSIGN/V1=C1.INPUT
                IF/V1>=5
                  GOTO/TRUE
                END_IF/
                ELSE/
                  GOTO/NOT_TRUE
                END_ELSE/
    TRUE       =LABEL/
                COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
                It is true!
    NOT_TRUE   =LABEL/
                COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
                It is NOT true!
    


    Hghlighting and seeing variable-->
    Is usually incorrect. Execute the program and type your number and run it offline to troubleshoot
Reply
  • Code-->

    I would do this
    ASSIGN/V2=V1
                ASSIGN/V1=C1.INPUT
                IF/V1>=5
                  GOTO/TRUE
                END_IF/
                ELSE/
                  GOTO/NOT_TRUE
                END_ELSE/
    TRUE       =LABEL/
                COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
                It is true!
    NOT_TRUE   =LABEL/
                COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
                It is NOT true!
    


    Hghlighting and seeing variable-->
    Is usually incorrect. Execute the program and type your number and run it offline to troubleshoot
Children
No Data