Text Variables (CHR$)

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

  • Text Variables (CHR$)

    I want to assign a variable with a Character String. I have had limited success and know I am doing something wrong. Any help here?

    Example:
    I want to assign the word TEST to V1

    I type in:
    ASSIGN/V1 = 'TEST'
    or
    ASSIGN/V1 = TEST
    and I can use this variable to Report the location of a feature named Test. However, if I print the variable in a Comment then it returns a value of 0.
    How do I tell PC DMIS that a variable is a CHR$ Variable?

    Thanks.
    Bill Jarrells
    A lie can travel half way around the world while the truth is putting on its shoes. - Mark Twain

  • #2
    Are you quoting the comment string ie:

    Code:
                ASSIGN/V1 = TEST
                COMMENT/OPER,NO,"This is the feature " + V1
    That may be your problem.
    <internet bumper sticker goes here>

    Comment


    • #3
      Hmm.
      So, there is no way to declare a variable either character or number?
      I am not doint it that way. I simply do the COMMENT/ REPORT thing and enter in the variable. PC DMIS tells me that V1 etc is a variable and asks me if I want to use the variable. I say YES and a 0 shows up on the report instead of the word TEST.
      I will try it that way, but that alone won't solve other issues I am having with CHR$ Variables.
      Bill Jarrells
      A lie can travel half way around the world while the truth is putting on its shoes. - Mark Twain

      Comment


      • #4
        Originally posted by craiger_ny View Post
        Are you quoting the comment string ie:

        Code:
                    ASSIGN/V1 = TEST
                    COMMENT/OPER,NO,"This is the feature " + V1
        That may be your problem.
        I tried it like this usiong empty quotes:
        "" + V1 and stiill reported 0
        It doesn;t appear that the variable is getting assigned as the text.
        Bill Jarrells
        A lie can travel half way around the world while the truth is putting on its shoes. - Mark Twain

        Comment


        • #5
          try this
          AssIGN/V1 = "TEST"
          then the comment like Craiger has it
          sigpic
          if you had soap on a rope it would be tied to yer ankle

          Comment


          • #6
            Originally posted by T Miller View Post
            try this
            AssIGN/V1 = "TEST"
            then the comment like Craiger has it
            That worked. But then I add 001 to it like this:
            ASSIGN/V2 = V1 + "001"
            and I get TEST1 instead of TEST001. I need TEST001.
            Bill Jarrells
            A lie can travel half way around the world while the truth is putting on its shoes. - Mark Twain

            Comment


            • #7
              what about this ASSIGN/ = C1.input
              Sheffield Cordax RS-150
              SMP-350
              PCDMIS 3.7mr3

              Comment


              • #8
                Sorry, Assign/test = c1.input
                Sheffield Cordax RS-150
                SMP-350
                PCDMIS 3.7mr3

                Comment


                • #9
                  Originally posted by Dannyrl View Post
                  what about this ASSIGN/ = C1.input
                  Doesn't input require operator intervention? If so then it is not what I need. Hmm, maybe the TEST1 IS what I need though and not TEST001!!

                  Thanks,
                  Bill Jarrells
                  A lie can travel half way around the world while the truth is putting on its shoes. - Mark Twain

                  Comment


                  • #10
                    Yes, it would require you to plug in a value. I misunderstood what you are wanting to do.
                    Sheffield Cordax RS-150
                    SMP-350
                    PCDMIS 3.7mr3

                    Comment


                    • #11
                      Originally posted by Dannyrl View Post
                      Yes, it would require you to plug in a value. I misunderstood what you are wanting to do.
                      Thanks for the response. It just looks like for some reason the Assign Command truncates off the preceeding zeros. Not a problem since I know what it is doing.
                      Bill Jarrells
                      A lie can travel half way around the world while the truth is putting on its shoes. - Mark Twain

                      Comment


                      • #12
                        All variables contain the value of 0 until execution (Documention says so). So the Prompt statement will show "0" until you run the program. The code listing will also show "0" until you run the program.

                        PCDMIS variables aren't declared in advance to be any particular type. The problem of the missing zeros is because PCDMIS is storing 003 as a number 3. If you put quotes about it (ie. "003") it would be stored as a string "003".

                        I have found that trying to manipulate strings within the PROMPT object dosn't seem to work too well. Its best to develop a variable with a complete prompt string prior to the PROMPT object then use the variable all by itself within the PROMPT.

                        I have been able to create a PROMPT using both a preset string and variable. But during each successive execution of the program another single quote would appear at the begining of the prompt in the PROMPT popup.

                        Comment


                        • #13
                          Originally posted by kneislyd View Post
                          All variables contain the value of 0 until execution (Documention says so). So the Prompt statement will show "0" until you run the program. The code listing will also show "0" until you run the program.

                          PCDMIS variables aren't declared in advance to be any particular type. The problem of the missing zeros is because PCDMIS is storing 003 as a number 3. If you put quotes about it (ie. "003") it would be stored as a string "003".

                          I have found that trying to manipulate strings within the PROMPT object dosn't seem to work too well. Its best to develop a variable with a complete prompt string prior to the PROMPT object then use the variable all by itself within the PROMPT.

                          I have been able to create a PROMPT using both a preset string and variable. But during each successive execution of the program another single quote would appear at the begining of the prompt in the PROMPT popup.
                          I finally got what I wanted to work. Still, putting quotes around the "001" and concatenating it with "TEST" resulted in TEST1 instead of TEST001. That's OK though and I can live with that even better after thinking about it for a while. I was getting ZERO because PC DMIS was using TEST1 and I was using TEST001. TEST001 was an empty variable so it returned the 0.

                          I haven't used the PROMPT with strings in any form yet but will keep this in mind.

                          Thanks,
                          Bill
                          Bill Jarrells
                          A lie can travel half way around the world while the truth is putting on its shoes. - Mark Twain

                          Comment


                          • #14
                            I have a sample snap shot of a program that appends 003 to a string.

                            varprg.jpg

                            Comment


                            • #15
                              Aha, there is a CONCAT command. I suspect that might be the difference. I used "TEST" + "001" and got TEST1
                              Thanks.
                              Bill Jarrells
                              A lie can travel half way around the world while the truth is putting on its shoes. - Mark Twain

                              Comment

                              Related Topics

                              Collapse

                              • Chally72
                                Custom Report Question
                                by Chally72
                                I'm making a custom report template, and I have a variable I have put in the header that will display either "ACCEPT" or "REJECT"...
                                09-16-2009, 06:46 PM
                              • N3WPV
                                Need help with variable
                                by N3WPV
                                I have the following code in my program:


                                Code:
                                ASSIGN/VFILENAMEDATE=SYSTEMDATE("yyyy''MM''dd")
                                ASSIGN/VFILENAMETIME=SYSTEMTIME("HHmmss")
                                ...
                                02-24-2013, 09:19 AM
                              • John Kugler
                                Variable help
                                by John Kugler
                                I'm trying to do a simple math problem inside a program. One dimension minus another equals whatever. I know it can be done, I just am having a little...
                                02-19-2009, 12:51 PM
                              • John Kugler
                                Variable Assistance
                                by John Kugler
                                Looking for some variable assistance. What I need is to change a variable to a certain letter.

                                Example:

                                ASSIGN/PROGRAMTYPE="SPECIAL"...
                                03-15-2018, 04:41 PM
                              • djayne
                                Assigning Variables
                                by djayne
                                I've searched through some of the archives and still can't get this down right. I'm asking the operator to enter the fixture letter of the part that...
                                07-27-2006, 03:04 PM
                              Working...
                              X