当前位置:网站首页>Application of script programming in barcode printing software (if statement)

Application of script programming in barcode printing software (if statement)

2020-11-10 16:03:07 Yu Xiaotao

Today, I'd like to introduce one of the applications of script coding in Zhonglang barcode printing software (if Sentence judgment ), Output new data according to known data , as follows : give Excel Table two columns of data ( data 1 Columns and data 2 Column ),

1、 data 1 by Y when , Regardless of the data 2 What is the output of a fixed value C

2、 data 1 Not for Y But it's not empty time either , data 2 If it is blank, output B, If it is not empty, output A.

3、 data 1 It's empty time , data 2 Not empty output A, If it is null, the output value is null .

 scripting 1.png 

Create a label in Zhonglang barcode printing software , open “ Database settings ”, add to “Excel Table data source ”, Database import Excel Two columns of data in the table .

 scripting 2.png 

 scripting 3.png 

Add three plain text to the white canvas , Import data 1 And data 2, The third normal text import data 1 and 2, The middle is separated by commas , And record the graphics of the third text ID.

 scripting 4.png 

Then add a fourth plain text , Reference the third text data in the form of data reference .

 scripting 5.png 

Then add a... To the right “ scripting ” Treatment method , utilize if Statement to realize the judgment data 1 And data 2, So we can get the corresponding data , Enter the code in the scripting input box :

var aa = dataObj.getOriginalDataValue() + "";

var bb=aa.split(",");    //split() function , Use commas to split into the following bb[0] and bb[1]

var cc;

if(bb[0]=="Y"){        //bb[0] It's data 1

cc="C";

}else if(bb[1]!=""){      //bb[1] Is the data 2

cc="A";

}else if(bb[0]!=""){

cc="B";

}else{

cc="";

}

strReturn=cc;

 scripting 6.png 

Because the third text data is temporarily added , Call only , There's no need to show... On the label , You can put the text outside the white canvas , So it doesn't print out , Change the font color of the fourth text to red to distinguish it from the original data , Print preview view batch label .

 scripting 7.png 

 scripting 8.png 

To sum up, it is one of the script programming in Zhonglang barcode printing software if Sentence usage , According to the known data, use if Statement to determine the conditions satisfied and output new data , More bar code printing software script programming applications can be found in this site related tutorials .

版权声明
本文为[Yu Xiaotao]所创,转载请带上原文链接,感谢