Barcodes are a pretty neato display object to create on a report. Before beginning creation of a barcode on an report make sure the barcode(s) you would like to use are setup under Shop Floor Control – Parameters -> General tab -> Bar code setup. If there is no barcode setup have an application consultant help you setup of a new barcode. The cool thing about barcodes is that anything can pretty much be barcoded, there are just times when you have to get creative about what needs to be barcoded. In my example I had to barcode two custom identification fields.
Okay lets get started:
1.) Declare the proper variables in the class declaration of the report
public class ReportRun extends ObjectRun
{
BarcodeSetupId barcodeSetupId;
BarcodeSetup barcodeSetup;
Barcode barcode;
Barcode barcode_SP;
}
2.) Initialize the barcode in the init method of the report all the sections pertaining to barcodes are in bold
public void init()
{
#DEFINE.BarCodeFontSize(52)
#DEFINE.BarCodeWidth(7000)
#DEFINE.BarCodeHeight(1400)
ReportStringControl rsc1,rsc2;
JmgParameters parms
;
super();
if(element.args().caller())
{
this.report().interactive(false);
this.query().interactive(false);
this.printJobSettings().preferredTarget(PrintMedium::Screen);
lines = element.args().record();
}
else
{
this.report().interactive(true);
this.query().interactive(true);
}
parms = JMGParameters::find();
barcodeSetupId = parms.BarcodeSetupId;
barcodeSetup = BarcodeSetup::find(barcodeSetupId);
barcode = barcodeSetup.barcode();
barcode_SP = barcodeSetup.barcode();
//WFS_PickListRouteSummary = this.args().record();
rsc1 = element.design().sectionName(“PageHeader”).controlName(identifierstr(barcode));
rsc1.visible(true);
rsc1.font(barcodeSetup.FontName);
rsc1.fontSize(#BarCodeFontSize);
rsc1.width100mm(#BarCodeWidth);
rsc1.height100mm(#BarCodeHeight);
}
3.) Create a display method for the barcode to be displayed on the form
//BP deviation documented
display BarCodeString barCode()
{
str barCodeContents;
wfsRMTruckLoadHeader tHeader = wfsRMTruckLoadHeader::find(wfsRMTruckLoadLines.TruckLoadId);
;
barCodeContents = WfsRMTruckLoadLines.TruckLoadId + tHeader.DriverId + tHeader.TruckId;
if (barcodeSetup.validateBarcode(strupr(barCodeContents)))
{
element.getBarCode().string(true,barCodeContents,barcodeContentType::Pallet);
element.getBarCode().encode();
}
else
{
throw(error(strfmt(“@SYS41409″, element.getBarCode().barcodeType(), strupr(barCodeContents))));
}
return element.getBarCode().barcodeStr();
}
4.) Declare this method below in the top methods section on the report
Barcode getBarCode()
{
return barcode;
}

Sorry, the comment form is closed at this time.