hexagon logo

Using Variables in READLINE

This is probably a simple syntax problem, but searching has not given me any clues.

Goal: automate report display of heat lot code unique to workpiece serial #.

Done: Operator inputs serial # which is assigned to variable V1.

Done: CSV file created with master list of serial #s in first column with heat lot codes in next column.

Not working: getting file pointer to look for a variable (V1 the serial #) to return text after.

The READLINE example from the Help is designed to look for a standard block of text (Part ID, Location, etc) to return text after.

In my code so far, file pointer looks for text "V1" but returns nothing as it's not looking for the value of variable V1.

Code:

C1         =COMMENT/INPUT,YES,'Serial Number:'
            ASSIGN/V1=C1.INPUT
FPTR       =FILE/OPEN,C:\BLADERUNNER\BLADES\ROW_2\ROW2_HEAT_LOT_CODES.CSV,READ
VREAD      =FILE/READLINE,FPTR, "V1" +{VCODE}
            COMMENT/REPT,VCODE
            FILE/CLOSE,FPTR,KEEP
.
.
.


Thanks in advance!
Parents
  • Readline is a serial read not a random read...

    You will have to loop to find what you want.


    I just discovered a method in the help file that may work, involving looping and treating the line as a string to be seperated into two variables. It's near the end of the READLINE section, in the Sample Code Dealing With Numbers Containing Preceding Zeros. If I can get this groggy CMM to boot up I'll test it and post it.



    Why the braces"{}" around your variables?

    The braces on the first variable V1 were just part of me trying different syntax to see what effect various character sets have on the execution of code. I was suprised to se that they made it skip over the delimiter.
    The braces on the second variable, VCODE, tell PCD to take the read-in data and store it in that variable. I got that from the READLINE help file.
Reply
  • Readline is a serial read not a random read...

    You will have to loop to find what you want.


    I just discovered a method in the help file that may work, involving looping and treating the line as a string to be seperated into two variables. It's near the end of the READLINE section, in the Sample Code Dealing With Numbers Containing Preceding Zeros. If I can get this groggy CMM to boot up I'll test it and post it.



    Why the braces"{}" around your variables?

    The braces on the first variable V1 were just part of me trying different syntax to see what effect various character sets have on the execution of code. I was suprised to se that they made it skip over the delimiter.
    The braces on the second variable, VCODE, tell PCD to take the read-in data and store it in that variable. I got that from the READLINE help file.
Children
No Data