Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Barcoding code128

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Barcoding code128

    The attached files are similar to Ira Perlow's UPCAFont functions, in fact Ira contributed changes
    which condensed and doubled the speed of my working functions.


    The implementation of Code128 barcoding represented here is limited to Type C. Type C handles

    number pairs 00-99. If you attempt to barcode the string "001", the result will be the barcode for

    "0001". I plan to work on a full implementation of Code128 as time permits.


    The encoded strings which are the results of these functions map to the CIA Code 128 fonts.

    Visit their website http://www.snx.com/demos.html for this font.


    Enjoy.
    There can be only one.

    #2
    RE: Barcoding code128

    I've made a couple of changes to strip out alphabetic characters entered (accidentally ?) to make sure the function works as intended. If a purely alphabetic string is processed for encoding, the function will encode "00".
    There can be only one.

    Comment


      #3
      RE: Barcoding code128

      The previous file also includes the demo version of a program with the barcode fonts, as mentioned in the first post.
      There can be only one.

      Comment


        #4
        Re: Barcoding code128

        Hi Stan
        I need to use a code 128 barcode within a label (preferably Id automations c128L)and I am wondering if your functions will encode my 24 digit string to use with the barcode font. I can generate the 24 digits but need the function that will encode it properly.

        Any guidance will be greatly appreciated.

        Neil

        Comment


          #5
          Re: Barcoding code128

          That was a long time ago. Worth a try.
          There can be only one.

          Comment


            #6
            Re: Barcoding code128

            Do you have a sample xbasic script that incorporates these functions?

            Comment


              #7
              Re: Barcoding code128

              As functions you use them like any other. Save/create them on the code tab.

              You define a calculated field for your label. The expression for the calculated field is

              code128(fieldvaluetobebarcoded)

              Place the calculated field on the label and set the proper font.

              I think the second function was the checksum calculator.
              There can be only one.

              Comment


                #8
                Re: Barcoding code128

                Thanks Stan. I'll give it a try. Is it useable with any c128 font? Or is there a specific one you used for this function ?

                Comment


                  #9
                  Re: Barcoding code128

                  The encoded strings which are the results of these functions map to the CIA Code 128 fonts.
                  Don't have any others to test.
                  There can be only one.

                  Comment


                    #10
                    Re: Barcoding code128

                    Hi Stan
                    I tried out your fuctions and the second function does do the check digit part of the barcode which is called from the first encoding function. I believe the math calculations to create the pairs of numbers is correct however the resulting text string is not. From my research I believe that once you build the number string with the check digit you have to pair up the numbers and assign the correct ascii character. ie replace a pair of 90 with a "z" - you have to do this for each pair using a loop. In your function you sting together a rather long looking set of characters that I can figure out.

                    Any ideas on this?

                    neil

                    Comment


                      #11
                      Re: Barcoding code128

                      The function processes the number string and tacks on the encoded check digit as the final step.

                      This section processes the number pairs to encoded values.

                      Code:
                      for i = 1 to pairs
                      ' ***************** Simplify pair selection
                      	prs=substr(F128n,(i*2)-1,2)
                             
                      	' Get the character for the font for the ith position in the barcode and
                              
                      	fontchar=SUBSTR(chr0099,(VAL(prs)*2)+1,2)
                      	fontstg=fontstg+fontchar
                      
                      next
                      If your font uses different encoding you need to change the part that builds the substiturion string chr0099.
                      There can be only one.

                      Comment


                        #12
                        Re: Barcoding code128

                        Do you think that using a lookup to a table that has the two digit pairs and the corresponding ASCII character or using a case statement to do the lookup to return the two digit pairs ASCII equivalent could work too to build the encoding string? I have the ascii map for my font. Here is the mapping.

                        http://www.barcoderesource.com/code128_barcode_map.html

                        Comment


                          #13
                          Re: Barcoding code128

                          Both of these links are invalid. What is the function used to calculate code128?

                          I found this but it seems like it will need some modification before it can be used as a function in alpha.

                          Code:
                            Public Function Code128$(chaine$)
                            'V 2.0.0
                              'Parameters : a string
                            'Return : * a string which give the bar code when it is dispayed with CODE128.TTF font
                            '         * an empty string if the supplied parameter is no good
                            Dim i%, checksum&, mini%, dummy%, tableB As Boolean
                            Code128$ = ""
                            If Len(chaine$) > 0 Then
                            'Check for valid characters
                              For i% = 1 To Len(chaine$)
                                Select Case Asc(Mid$(chaine$, i%, 1))
                                Case 32 To 126, 203
                                Case Else
                                  i% = 0
                                  Exit For
                                End Select
                              Next
                              'Calculation of the code string with optimized use of tables B and C
                              Code128$ = ""
                              tableB = True
                              If i% > 0 Then
                                i% = i% become the string index
                                Do While i% <= Len(chaine$)
                                  If tableB Then
                                    'See if interesting to switch to table C
                                    'yes for 4 digits at start or end, else if 6 digits
                                    mini% = IIf(i% = 1 Or i% + 3 = Len(chaine$), 4, 6)
                                    GoSub testnum
                                    If mini% < 0 Then 'Choice of table C
                                      If i% = 1 Then 'Starting with table C
                                        Code128$ = Chr$(210)
                                      Else 'Switch to table C
                                        Code128$ = Code128$ & Chr$(204)
                                      End If
                                      tableB = False
                                    Else
                                      If i% = 1 Then Code128$ = Chr$(209) 'Starting with table B
                                    End If
                                  End If
                                  If Not tableB Then
                                    'We are on table C, try to process 2 digits
                                    mini% = 2
                                    GoSub testnum
                                    If mini% < 0 Then 'OK for 2 digits, process it
                                      dummy% = Val(Mid$(chaine$, i%, 2))
                                      dummy% = IIf(dummy% < 95, dummy% + 32, dummy% + 105)
                                      Code128$ = Code128$ & Chr$(dummy%)
                                      i% = i% + 2
                                    Else 'We haven't 2 digits, switch to table B
                                      Code128$ = Code128$ & Chr$(205)
                                      tableB = True
                                    End If
                                  End If
                                  If tableB Then
                                    'Process 1 digit with table B
                                    Code128$ = Code128$ & Mid$(chaine$, i%, 1)
                                    i% = i% + 1
                                  End If
                                Loop
                                'Calculation of the checksum
                                For i% = 1 To Len(Code128$)
                                  dummy% = Asc(Mid$(Code128$, i%, 1))
                                  dummy% = IIf(dummy% < 127, dummy% - 32, dummy% - 105)
                                  If i% = 1 Then checksum& = dummy%
                                  checksum& = (checksum& + (i% - 1) * dummy%) Mod 103
                                Next
                                'Calculation of the checksum ASCII code
                                checksum& = IIf(checksum& < 95, checksum& + 32, checksum& + 105)
                                'Add the checksum and the STOP
                                Code128$ = Code128$ & Chr$(checksum&) & Chr$(211)
                              End If
                            End If
                            Exit Function
                          testnum:
                            'if the mini% characters from i% are numeric, then mini%=0
                            mini% = mini% - 1
                            If i% + mini% <= Len(chaine$) Then
                              Do While mini% >= 0
                                If Asc(Mid$(chaine$, i% + mini%, 1)) < 48 Or Asc(Mid$(chaine$, i% + mini%, 1)) > 57 Then Exit Do
                                mini% = mini% - 1
                              Loop
                            End If
                          Return
                          End Function
                          Last edited by hov333; 11-29-2016, 01:17 PM.

                          Comment


                            #14
                            Re: Barcoding code128

                            I didn't install the code128.ttf so I haven't tested it but I made a stab at translating the function.

                            code128 - 11-29-2016 -1.txt
                            There can be only one.

                            Comment


                              #15
                              Hello all! I need to get Code128 working for my application, so I came across this old post. I must confess that I really don't understand it all. Was there a finished and complete function ever completed? Any ideas would help quite a bit. Many thanks!

                              Comment

                              Working...
                              X