Working 128 barcode example

blackc2005blackc2005 Posts: 15Member
Hi, I need to generate barcodes in reports in NAV2013. I have downloaded multiple of the examples from the files section but none of them seem to work/scan. Some of them have unprintable chars in the barcode (start and stop chars) others print but don't scan at all.
I've tried these:
https://mibuso.com/downloads/barcode39-in-pure-c-al
https://mibuso.com/downloads/barcode-128-with-fonts-sample

Can anyone point me to one that's actually working or tell me an alternative to creating basic barcodes in NAV?

Thanks.

Answers

  • SanderDkSanderDk Posts: 248Member
    edited 2019-08-10
    What is your case?
    Do you need to print a label? add a bar code to a invoice?
    What kind of barcode do you need?
    For help, do not use PM, but use forum instead, perhaps other people have the same question, or better answers.
  • ResolusResolus Posts: 9Member
    I've used https://mibuso.com/downloads/ean-8-13-code-39-128-barcode-creator-v1.5 and it worked great.

    I did have to change something to get black and white barcodes (instead of black and dark grey), but I can't entirely remember what it was.
  • midegomidego Apeldoorn, The NetherlandsPosts: 37Member
    For barcode scanners, sometimes you have to add the start and stop character, we use * as start and stop and add this as a character before and after the barcode.
  • blackc2005blackc2005 Posts: 15Member
    Resolus wrote: »
    I've used https://mibuso.com/downloads/ean-8-13-code-39-128-barcode-creator-v1.5 and it worked great.

    I did have to change something to get black and white barcodes (instead of black and dark grey), but I can't entirely remember what it was.

    Would you happen to still be using this? Could you send me a FOB of the files? The one I downloaded doesn't seem to scan at all.
  • blackc2005blackc2005 Posts: 15Member
    edited 2019-08-12
    midego wrote: »
    For barcode scanners, sometimes you have to add the start and stop character, we use * as start and stop and add this as a character before and after the barcode.

    Does this work with the 128 codes? I thought the 128 needed special chars for start and stop.
  • midegomidego Apeldoorn, The NetherlandsPosts: 37Member
    Why don't you try it, it works here.
  • ftorneroftornero Posts: 233Member
    Hello @blackc2005

    you can use a DLL from ZXing and get a code128 image from the code you need to print

    qpcj94tco6dz.png

    This is the report with the example:
    OBJECT Report 50001 Label Cod128
    {
      OBJECT-PROPERTIES
      {
        Date=14/08/19;
        Time=10:22:31;
        Modified=Yes;
        Version List=COD128;
      }
      PROPERTIES
      {
        Permissions=TableData 297=rm;
      }
      DATASET
      {
        { 7141745; ;DataItem;                    ;
                   DataItemTable=Table27;
                   DataItemTableView=SORTING(No.);
                   OnAfterGetRecord=BEGIN
                                      BarCod128("No.", 1000, 2250, tmpBlob);
                                    END;
    
                   ReqFilterFields=No. }
    
        { 7141744;1;Column  ;CodBarras           ;
                   SourceExpr=tmpBlob.Blob }
    
        { 1000000000;1;Column;ItemNo             ;
                   SourceExpr=Item."No." }
    
      }
      REQUESTPAGE
      {
        PROPERTIES
        {
        }
        CONTROLS
        {
        }
      }
      LABELS
      {
      }
      CODE
      {
        VAR
          [email protected] : TEMPORARY Record 99008535;
    
        PROCEDURE [email protected]([email protected] : Code[1024];[email protected] : Integer;[email protected] : Integer;VAR [email protected] : TEMPORARY Record 99008535);
        VAR
          [email protected] : DotNet "'zxing, Version=0.16.0.0, Culture=neutral, PublicKeyToken=830ae994e36ac27d'.ZXing.BarcodeFormat";
          [email protected] : DotNet "'zxing, Version=0.16.0.0, Culture=neutral, PublicKeyToken=830ae994e36ac27d'.ZXing.Common.EncodingOptions";
          [email protected] : DotNet "'zxing, Version=0.16.0.0, Culture=neutral, PublicKeyToken=830ae994e36ac27d'.ZXing.BarcodeWriter";
          [email protected] : DotNet "'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.System.Drawing.Bitmap";
          [email protected] : DotNet "'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.System.Drawing.Imaging.ImageFormat";
          [email protected] : DotNet "'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.IO.MemoryStream";
          [email protected] : OutStream;
        BEGIN
          CLEAR(pTmpTempBlob);
    
          BarCodeFormat := BarCodeFormat.CODE_128;
    
          Options := Options.EncodingOptions;
          Options.Height := pHeight;
          Options.Width := pWidth;
    
          BarCodeWriter := BarCodeWriter.BarcodeWriter;
          BarCodeWriter.Format := BarCodeFormat;
          BarCodeWriter.Options := Options;
          Bitmap := BarCodeWriter.Write(pcodBarcode);
    
          MemStr := MemStr.MemoryStream();
          Bitmap.Save(MemStr, ImagingFormat.Png);
    
          pTmpTempBlob.Blob.CREATEOUTSTREAM(OutStr);
          COPYSTREAM(OutStr, MemStr);
        END;
    
        BEGIN
        END.
      }
    
    

    Regards

  • ftorneroftornero Posts: 233Member
    edited 2019-08-14
    Here is the RDLDATA that does not fit in a single message, you need to add the two parts.
      RDLDATA
      {
        <?xml version="1.0" encoding="utf-8"?>
    <Report xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition">
      <DataSources>
        <DataSource Name="DataSource">
          <ConnectionProperties>
            <DataProvider>SQL</DataProvider>
            <ConnectString />
          </ConnectionProperties>
          <rd:DataSourceID>3b60dfeb-6f42-4c45-8183-0f3a4bc4f0dc</rd:DataSourceID>
        </DataSource>
      </DataSources>
      <DataSets>
        <DataSet Name="DataSet_Result">
          <Fields>
            <Field Name="CodBarras">
              <DataField>CodBarras</DataField>
            </Field>
            <Field Name="ItemNo">
              <DataField>ItemNo</DataField>
            </Field>
            <Field Name="ItemDescription">
              <DataField>ItemDescription</DataField>
            </Field>
          </Fields>
          <Query>
            <DataSourceName>DataSource</DataSourceName>
            <CommandText />
          </Query>
          <rd:DataSetInfo>
            <rd:DataSetName>DataSet</rd:DataSetName>
            <rd:SchemaPath>Report.xsd</rd:SchemaPath>
            <rd:TableName>Result</rd:TableName>
          </rd:DataSetInfo>
        </DataSet>
      </DataSets>
      <Body>
        <ReportItems>
          <Tablix Name="Tablix1">
            <TablixBody>
              <TablixColumns>
                <TablixColumn>
                  <Width>4.11417in</Width>
                </TablixColumn>
              </TablixColumns>
              <TablixRows>
                <TablixRow>
                  <Height>5.82677in</Height>
                  <TablixCells>
                    <TablixCell>
                      <CellContents>
                        <Rectangle Name="Rectangle2">
                          <ReportItems>
                            <Image Name="Image1">
                              <Source>Database</Source>
                              <Value>=Fields!CodBarras.Value</Value>
                              <MIMEType>image/jpeg</MIMEType>
                              <Sizing>Fit</Sizing>
                              <Top>0.50271cm</Top>
                              <Left>0.31751cm</Left>
                              <Height>3.02805cm</Height>
                              <Width>9.86791cm</Width>
                              <Style>
                                <Border>
                                  <Style>None</Style>
                                </Border>
                              </Style>
                            </Image>
                          </ReportItems>
                          <KeepTogether>true</KeepTogether>
                          <Style>
                            <Border>
                              <Style>Solid</Style>
                            </Border>
                          </Style>
                        </Rectangle>
                      </CellContents>
                    </TablixCell>
                  </TablixCells>
                </TablixRow>
              </TablixRows>
            </TablixBody>
            <TablixColumnHierarchy>
              <TablixMembers>
                <TablixMember>
                  <TablixMembers>
                    <TablixMember />
                  </TablixMembers>
                </TablixMember>
              </TablixMembers>
            </TablixColumnHierarchy>
            <TablixRowHierarchy>
              <TablixMembers>
                <TablixMember>
                  <TablixMembers>
                    <TablixMember>
                      <Group Name="Group1">
                        <GroupExpressions>
                          <GroupExpression>=Fields!ItemNo.Value</GroupExpression>
                        </GroupExpressions>
                      </Group>
                      <SortExpressions>
                        <SortExpression>
                          <Value>=Fields!ItemNo.Value</Value>
                        </SortExpression>
                      </SortExpressions>
                      <TablixHeader>
                        <Size>0.98425in</Size>
                        <CellContents>
                          <Textbox Name="Group1">
                            <CanGrow>true</CanGrow>
                            <KeepTogether>true</KeepTogether>
                            <Paragraphs>
                              <Paragraph>
                                <TextRuns>
                                  <TextRun>
                                    <Value>=Fields!ItemNo.Value</Value>
                                    <Style />
                                  </TextRun>
                                </TextRuns>
                                <Style />
                              </Paragraph>
                            </Paragraphs>
                            <rd:DefaultName>Group1</rd:DefaultName>
                            <Style>
                              <Border>
                                <Style>Solid</Style>
                              </Border>
                              <PaddingLeft>2pt</PaddingLeft>
                              <PaddingRight>2pt</PaddingRight>
                              <PaddingTop>2pt</PaddingTop>
                              <PaddingBottom>2pt</PaddingBottom>
                            </Style>
                          </Textbox>
                        </CellContents>
                      </TablixHeader>
                      <TablixMembers>
                        <TablixMember />
                      </TablixMembers>
                    </TablixMember>
                  </TablixMembers>
                </TablixMember>
              </TablixMembers>
            </TablixRowHierarchy>
            <DataSetName>DataSet_Result</DataSetName>
            <PageBreak>
              <BreakLocation>End</BreakLocation>
            </PageBreak>
            <Height>14.8cm</Height>
            <Width>12.94999cm</Width>
            <Style>
              <Border>
                <Style>None</Style>
              </Border>
            </Style>
          </Tablix>
        </ReportItems>
        <Height>14.8cm</Height>
        <Style />
      </Body>
      <Code>Public Function BlankZero(ByVal Value As Decimal)
        if Value = 0 then
            Return ""
        end if
        Return Value
    End Function
    
    Public Function BlankPos(ByVal Value As Decimal)
        if Value &gt; 0 then
            Return ""
        end if
        Return Value
    End Function
    
    Public Function BlankZeroAndPos(ByVal Value As Decimal)
        if Value &gt;= 0 then
            Return ""
        end if
        Return Value
    End Function
    
    Public Function BlankNeg(ByVal Value As Decimal)
        if Value &lt; 0 then
            Return ""
        end if
        Return Value
    End Function
    
    Public Function BlankNegAndZero(ByVal Value As Decimal)
        if Value &lt;= 0 then
            Return ""
        end if
        Return Value
    End Function
    </Code>
      <Width>12.94999cm</Width>
      <Page>
        <PageHeight>14.8cm</PageHeight>
        <PageWidth>10.5cm</PageWidth>
        <ColumnSpacing>1.27cm</ColumnSpacing>
        <Style />
      </Page>
      <Language>=User!Language</Language>
      <ConsumeContainerWhitespace>true</ConsumeContainerWhitespace>
      <rd:ReportID>0eeb6585-38ae-40f1-885b-8d50088d51b4</rd:ReportID>
      <rd:ReportUnitType>Cm</rd:ReportUnitType>
    </Report>
        END_OF_RDLDATA
      }
    }
    
  • blackc2005blackc2005 Posts: 15Member
    midego wrote: »
    Why don't you try it, it works here.

    I did try it and it didn't work. Thanks.
  • ResolusResolus Posts: 9Member
    blackc2005 wrote: »
    Resolus wrote: »
    I've used https://mibuso.com/downloads/ean-8-13-code-39-128-barcode-creator-v1.5 and it worked great.

    I did have to change something to get black and white barcodes (instead of black and dark grey), but I can't entirely remember what it was.

    Would you happen to still be using this? Could you send me a FOB of the files? The one I downloaded doesn't seem to scan at all.

    I'm sorry for the delayed response.
    I'll send you a txt version.
Sign In or Register to comment.