Kamis, 26 Juli 2012

Microsoft Dynamics Navigate 2009 Tips Part 3

Hello Again,

This time i want to share how to make a simple Barcode in Report with Microsoft Dynamics Nav 2009.
this simple tutorial contributed by Dobson Software. This tutorial only for classic client, for further example to display barcode in RTC read the second part of this tutorial.

Before we start to create the barcode, first prepare some exquisites report to display a text / code in barcode.

1. Report in nav go to Sections and preserve some space for Barcode (*)
2. Install Font Code128BWin if you didnt find where to find it just download from this
    Code 128B Nav by Geert Rozendom
3. Extract the archive and find the *.ttf file or Code128BWin file, install it on Windows Control Panel
*. Length of barcode depends on input, it can be very long to small length.
Tutorial :

1.First just as i described in preparation, create report :

2. Open Global C/AL and Create Function for Barcode

3. Click Locals for the function, first create Variable for input the code / text to change into barcode

4. Set Return Value with Type text, and length 250

5. Set Variables to be used in function :

6. Now for the code, go to Code Unit for the function or Press F9 : and use this code :

MinValidASC := 32;
MaxValidASC := 156;
ValidASC := '?'; // Question Char
//start char alt+0154  stop char alt+0156
StartChar:='š';    // Press ALT+0154
StopChar:='œ';  //Press ALT+0156

Checksum := 104;

  TempCheck := COPYSTR(InCode,i,1);
  CharASC := TempCheck[1];
  IF ((CharASC < MinValidASC) OR (CharASC > MaxValidASC)) THEN
       CharASC := ValidASC[1];
       InvalidCharFound := TRUE
  Checksum := Checksum +(i*(CharASC-32));

ChecksumChar := (Checksum MOD 103);
IF (ChecksumChar < 95) THEN
    ChecksumChar := ChecksumChar + 32
    ChecksumChar := ChecksumChar + 100;
InCode:=CONVERTSTR(InCode,' ','€'); // Press ALT+0128
//SpaceChar := ' ';


 7. Now save and make sure the error message not occured

8. Go to Section again, and create a text box beside the field, just as i explained on preparation

9. Open Property of the text box, and go to font name, change it to Code128bWin
    (make sure that Code128Bwin.ttf already installed)
    change  the font size to more than 14 or more
    Change the Sourceexp  with FunctionName('Field Record')

10. Save and make sure the Barcode has appropriate Length to display it.
11.  Finish

In the code unit within comment with ALT+0156 or like it, press it simultaneusly. This Char cannot be copied because its dependen on system fonts and character.

Second Tutorial for displaying Barcode on report in RTC Client :

1. After complete the first tutorial for display a barcode on report classic, save the report and open
   object designer again.
2. Open View Menu and Select Layout to design layout for report in RTC.
3. In layout visual studio report, select Dataset -> Result -> Drag field and the Barcode Function
    Name on the report.

4. Look on Report-Body properties, and go to Font. Select FontFamily to Code128bWin /
    Code128bWinLarge, set the size of the font too.


5. Change font property on Barcode field too, same with the body font family.
6. Save the report, and back to Object Designer. Save again the Report and preview the report on RTC

1 komentar:

  1. Good post. Thanks for sharing this article about barcode. I don't know how to display text below barcode on report. Can you tell me how to do that? Thanks in advance.