web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

CAL coding , Navision 2018

(0) ShareShare
ReportReport
Posted on by 70

Need to extract the Container ID field from the Warehouse Entry table , I want it to print as label and as well as barcode separately , both as separate fields . I want it as code please . 

  • Suggested answer
    Amit Baru Profile Picture
    3,043 on at

    Hi,

    Pls use two function for barcode generation.

    EAN13_10String(InputBarcode : Code[20]) : Text
    // In Separators '2' is used to identify line length for nicer look'n'feel
    LRSeparator := '202';
    CSeparator := '02020';
    Weight := '131313131313';

    // If barcode is already with Checksum digit at the end
    IF STRLEN(InputBarcode) = 13 THEN BEGIN
    EVALUATE(CheckDigit,COPYSTR(InputBarcode,13,1));
    CurrentBarcode := COPYSTR(InputBarcode,1,12);
    //Comparing checkdigit
    IF CheckDigit <> STRCHECKSUM(CurrentBarcode,Weight,10) THEN BEGIN
    ERROR(Text003);
    END;
    END ELSE BEGIN
    IF STRLEN(InputBarcode) <> 12 THEN
    ERROR(Text001,12);
    CurrentBarcode := InputBarcode;
    END;

    FOR Count := 1 TO STRLEN(CurrentBarcode) DO BEGIN
    //Checking if barcode constructed only of digits
    IF NOT (CurrentBarcode[Count] IN ['1','2','3','4','5','6','7','8','9','0']) THEN
    ERROR(Text002);
    END;

    //Initializing EAN13 structure
    InitEAN13Structure(Structure,Encoding);

    //Checkdigit again
    CheckDigit := STRCHECKSUM(CurrentBarcode,Weight,10);

    //Barcode to encode with checksum
    BarcodeWithCheckSum := COPYSTR(CurrentBarcode,2,STRLEN(CurrentBarcode)) + FORMAT(CheckDigit);

    //Structure to use (Left Part)
    EVALUATE(StructureIndex,FORMAT(CurrentBarcode[1]));
    StructureIndex := StructureIndex + 1;
    LeftStructure := Structure[StructureIndex];

    //Add Beginning lines
    EncodedBarcode := EncodedBarcode + LRSeparator;

    FOR Count := 1 TO STRLEN(BarcodeWithCheckSum) DO BEGIN
    //Add Middle Lines
    IF Count = 7 THEN BEGIN
    EncodedBarcode := EncodedBarcode + CSeparator;
    END;
    //Getting Barcode digit by index
    EVALUATE(NumberEval,FORMAT(BarcodeWithCheckSum[Count]));

    IF Count <= 6 THEN BEGIN
    //Left Part
    CASE LeftStructure[Count] OF
    'L': EncodedBarcode := EncodedBarcode + Encoding[NumberEval + 1][1];
    'G': EncodedBarcode := EncodedBarcode + Encoding[NumberEval + 1][2];
    END;
    END ELSE BEGIN
    //Right Part
    EncodedBarcode := EncodedBarcode + Encoding[NumberEval + 1][3];
    END;

    END;

    //Ending Lines
    EncodedBarcode := EncodedBarcode + LRSeparator;

    EXIT(EncodedBarcode);

    LOCAL InitEAN13Structure(VAR Structures : ARRAY [10] OF Text[6];VAR Encodings : ARRAY [10,3] OF Text[7])
    Structures[1] := 'LLLLLL';
    Structures[2] := 'LLGLGG';
    Structures[3] := 'LLGGLG';
    Structures[4] := 'LLGGGL';
    Structures[5] := 'LGLLGG';
    Structures[6] := 'LGGLLG';
    Structures[7] := 'LGGGLL';
    Structures[8] := 'LGLGLG';
    Structures[9] := 'LGLGGL';
    Structures[10] := 'LGGLGL';

    Encodings[1][1] := '0001101';
    Encodings[1][2] := '0100111';
    Encodings[1][3] := '1110010';
    Encodings[2][1] := '0011001';
    Encodings[2][2] := '0110011';
    Encodings[2][3] := '1100110';
    Encodings[3][1] := '0010011';
    Encodings[3][2] := '0011011';
    Encodings[3][3] := '1101100';
    Encodings[4][1] := '0111101';
    Encodings[4][2] := '0100001';
    Encodings[4][3] := '1000010';
    Encodings[5][1] := '0100011';
    Encodings[5][2] := '0011101';
    Encodings[5][3] := '1011100';
    Encodings[6][1] := '0110001';
    Encodings[6][2] := '0111001';
    Encodings[6][3] := '1001110';
    Encodings[7][1] := '0101111';
    Encodings[7][2] := '0000101';
    Encodings[7][3] := '1010000';
    Encodings[8][1] := '0111011';
    Encodings[8][2] := '0010001';
    Encodings[8][3] := '1000100';
    Encodings[9][1] := '0110111';
    Encodings[9][2] := '0001001';
    Encodings[9][3] := '1001000';
    Encodings[10][1] := '0001011';
    Encodings[10][2] := '0010111';
    Encodings[10][3] := '1110100';

    https://erpconsultors.com/generate-barcode-in-business-central/

    Regards

    Amit Sharma

    www.erpconsultors.com

  • Yathish JR Profile Picture
    70 on at

    I want code for adding and extracting the Container ID field from the Warehouse Entry table please

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 741 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 514 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 336 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans