Link to home
Start Free TrialLog in
Avatar of Aravind Ranganathan
Aravind Ranganathan

asked on

How to concatenate fields in zpl, and how to use conditional statement?

This is my zpl code:

^XA
^MCY^PRD,D,D^MMT,N^XZ
^XA   
^FWB                                                                                        
^DFCASENEW^FS                                               
^LH0,0                                                    
^FO15,90^A0,90,88^FN01^FS^FX Company^FS
^FO1650,430^A0,163,114^FN02^FS^FX Item Number^FS 
^FO250,59^A0N,109,78^FN03^FS^FX Description^FS 
^FO250,150^A0N,90,58^FN04^FS^FX Units Per Carton^FS 
^FO320,150^A0,90,108^FDX^FS  
^FO380,150^A0N,90,58^FN05^FS^FX Net Weight^FS
^FO450,350^A0N,90,58^FN06^FS^FX CaseUPC^FS 
^BY3.4,,230^FO130,450^BCN,,N,N,N,N^FN07^FS^FX RotationProduct^FS
^FO10,703^A0N,32,94^FN08^FS^FX RotationProduct^FS
^FO150,63^A0,100,102^FN09^FS^FX Rotation^FS
^FO1562,50^A0,90,66^FDBest Before^FS     
^FO1650,30^A0,134,100^FN10^FS^FX BestBefore^FS    
^XZ                                                           

^XA^XFCASENEW             
^FN01^FDLawn Mover^FS                        
^FN02^FD1234^FS                           
^FN03^FDVeryTastyProduct^FS  
^FN04^FD10^FS  
^FN05^FD150 G^FS  
^FN06^FD000234523447990^FS                           
^FN07^FD(01)00077123456789(19)12345(10)A1230(21)4588^FS                              
^FN08^FD(01)00077123456789(19)12345(10)A1230(21)4588^FS                                    
^FN09^FDA1230^FS                          
^FN10^FD01JUN17^FS                        
^PQ1,0,1,Y                                
^XZ                                       
^XA^MCY^XZ

Open in new window


So i am relatively new to zebra programming language.

i need  for the company do a if then on the zpl,
for eaxmple

if company #12345
Then Company1
if  company #67891
Then Comapny2

Also how can i add similar fields together? for example

i want CaseUPC + RotationProduct + Rotation as one field

^FN06^FD000234523447990^FS  + ^FN08^FD(01)00077123456789(19)12345(10)A1230(21)4588^FS +                                  ^FN09^FDA1230^FS

one last question,

is there a way for me to do a substring on these fields, i have a field : ^FN06^FD000234523447990^FS i need the starting 0 to be one font and the following 5 numbers to be another font, i then want another 9 to be another font.

i am new to ZPL programming i looked at https://www.zebra.com/content/dam/zebra/manuals/en-us/software/zpl-zbi2-pm-en.pdf for help but i am not understanding how i can do  

10 IF A$="0" THEN
20 PRINT "ZBI IS FUN"
30 ELSE IF A$="1" THEN
40 PRINT "ZBI IS EASY"
50 ELSE IF TIME=1 THEN
60 PRINT "It is one second past midnight"
70 ELSE
80 PRINT "X=0"
90 END IF

in my case :(
ASKER CERTIFIED SOLUTION
Avatar of Gary Patterson, CISSP
Gary Patterson, CISSP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aravind Ranganathan
Aravind Ranganathan

ASKER

We actually used parameters at the bottom to satisfy my question.