Skip to main content
1-Visitor
May 20, 2015
Solved

Isodraw Macro ignores the leading zeroes

  • May 20, 2015
  • 1 reply
  • 3432 views

Hi Gang,

I wrote a macro for giving the ICN numbers in the illustrations. It will ask the user some specific inputs. There is a place where it will ask for the starting and ending value numbers. User would give the starting number as 00001 and ending as 0010 (for example). After running the macro when we see the file name and the ICN number in the file, zeroes in front of the value are ignored and it is displayed as 1 and 10. Why Isodraw ignores the zeroes?.

Best answer by thendricks

Looks like there may be some other errors in your macro (Run Macro?) so I parsed out the basics to get you what you needed.

Macro ICN

  Define stval as String

  Define endval as String

  Define partno as String

  Define ata as String

  Define stng as String

  Define base as String

  Define base1 as String

  Define base2 as String

  Define base3 as String

  Define base4 as String

  Define pathI  as String

  Define extI  as String

  Define fname as String

  Define cgmname as String

  Define size as Integer

  stval =get integer "Starting Number"

  endval=get integer "Ending Number"

  partno=get String "Part No."

  ata =get String "ATA"

    while (stval <= endval)

    stng = stval

    base1= "ICN-"

      base2="-A-"

      base3="-X-B-4050G-"

      base4="-A-001-1"

      while (len(stng)<5)

        stng = '0' + stng

      end while

      base =base1+partno+base2+ata+base3+stng+base4

      message base

      stval=stval+1

   end while

End Macro

1 reply

12-Amethyst
May 20, 2015

My guess is that the variables you are using for the ICN values are declared as numbers. What you are attempting to capture however, is not a number. Try declaring your values as strings instead.

sk-31-VisitorAuthor
1-Visitor
May 21, 2015

Hi Trevor,

Thanks for the reply. Below is my code. I have to declare the variables as integers otherwise the values will not get incremented. Any help is appreciated.

Macro Something

define stval as integer

define endval as integer

stval=get integer "Starting Number"

endval=get integer "Ending Number"

while(stval>=endval)

Create text "some point"

stval=stval+1

end while

end macro

12-Amethyst
May 21, 2015

My suggestion then is to treat the field as an integer as you have. Before outputting it however you'll want to check the character length of the integer and then prefix the necessary number of zeros. You can then output that value while maintaining your integer variable for incrementing.