Keeping zero in cutted string that contain only numbers as characters

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

  • Keeping zero in cutted string that contain only numbers as characters

    Hello all,

    how can i force pcdmis to keep zero before number, or not to convert string (cutted into smaller string containing only numbers) to number ?
    Example:

    Code:
         ASSIGN/PN="ABC00015"
                    ASSIGN/PN1=MID(PN,0,3)
                    ASSIGN/PN2=MID(PN,3,5)
    for PN1 i gor ABC, but for PN2 i got 15, not 00015 (string)

  • #2
    Code:
    assign/pn="abc000"+15
    PcDmis 2015.1 SP10 CAD++
    Global 7-10-7 DC800S

    Comment


    • #3
      mb0258 Where are you assigning this? just curious
      Last edited by KIRBSTER269; 03-14-2018, 09:27 AM.
      (In Memory of my Loving wife, "Ronda" who I lost March 7, 2016. I love you baby.)
      They say "Nobody's Perfect." I must be Nobody.

      Comment


      • Kp61dude!
        Kp61dude! commented
        Editing a comment
        A solid 1600 posts Kirby!

      • KIRBSTER269
        KIRBSTER269 commented
        Editing a comment
        Kp61dude! just means I talk to much well screwed that up
        Last edited by KIRBSTER269; 03-14-2018, 09:48 AM.

      • KIRBSTER269
        KIRBSTER269 commented
        Editing a comment
        Kp61dude! also, Shhheeeww, better go refill on coffee

    • #4
      Code:
      assign/pn2 = str(mid(pn,3,5))

      B&S CHAMELEON/PCDMIS CAD++ V2011

      There are no bugs, only "UNDOCUMENTED ENHANCEMENTS!"

      sigpic

      Comment


      • KIRBSTER269
        KIRBSTER269 commented
        Editing a comment
        still kinda curious what this is assigned to, because Comment and Tracefield, the original code works fine.

    • #5
      KIRBSTER269 each part have unique code, like 20 char. I'm chopping this string to get, date, batch N°, size of part, etc.
      so for example batch N° is from 00001 to 99999 and I use these to generater report header, file name, folder name etc.

      In my example it work fine, but when you will use PN2 in another variable like folder size, instead of filename 00015 i got 15
      dph51 I will try.

      Comment


      • KIRBSTER269
        KIRBSTER269 commented
        Editing a comment
        So it works fine on the header, but when it dumps it out of PC-DMIS, it only shows up the 15? I kinda figured it was an assignment for Part Number or Batch. Was just curious how it was applied. Thanks for letting me know. I appreciate that.

    • #6
      Just tried dph51 tip and it's work for me, Thank You very much.

      Comment


      • KIRBSTER269
        KIRBSTER269 commented
        Editing a comment
        dph51 the king of scripting

      • Kp61dude!
        Kp61dude! commented
        Editing a comment
        He really is!

      • vpt.se
        vpt.se commented
        Editing a comment
        Not scripting though... ;P

        Pure PC-DMIS command.

    Related Topics

    Collapse

    Working...
    X