Solved

concatenate string and variable in ZPL

  • 17 September 2021
  • 1 reply
  • 490 views

Userlevel 3
Badge

Regarding the SETVAR ZLP keyword, want to use a variable to define the ‘Pn for parameter n’. I need to concatenate “P” with my index variable i. How do I accomplish this?

Thank you,

John 

icon

Best answer by Csilla Timar-Fulep 21 September 2021, 15:33

View original

1 reply

Userlevel 5
Badge +2

Hi John,

Thanks for you question here on the forums.

You may use the following ZPL macro syntax, where param and surf are integers:

code$ = "P" + $STR(param)
SETVAR surf, code$, 1

For more details about how to use strings in the ZPL macro language, please check out this knowledgebase article:
Working with strings in ZPL Macros – Knowledgebase (zemax.com)

Best,
Csilla

Reply