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

numbering a character field in sequence

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

  • numbering a character field in sequence

    have a character field - `mtrl_no` (indexed)- this not an auto increament field but nos. manually entered.

    would like display of records 1...10 then 11...20 & so on.

    but presently after 10 get 100

    probably could solve by changing to numeric field but also have a `lot_no` field where data is A B C D and so on (also manually entered) . which is calculated in a `mtrl_no_calc` field as
    `mtrl_no+lot_no`

    so would like to retain `mtrl_no` as character field besides several reports created & if change to numeric field too much work to change all.

    any help would be appreciated to show how to display numbers in a proper sequence in a character field.

    thanks,
    v.p

  • #2
    RE: numbering a character field in sequence

    try putting a numeric only mask in field rules for that particular field - will force to numeric

    then check out PADL (pad left) in the manual

    I'm not sure whether it would be acceptable, but you could do a pad left with zeros
    thus
    001
    002
    003
    100
    etc.
    this would make the field sort corrrectly

    if the numbers are maually entered I presume that an operator might enter 10, then 1003, then 33, etc. and that there is some reason for same.
    Cole Custom Programming - Terrell, Texas
    972 524 8714
    [email protected]

    ____________________
    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

    Comment


    • #3
      RE: numbering a character field in sequence

      dear martin,

      re entering nos. manually as numeric is not the problem & operators strictly comply to this.

      the nos. are not added at random but in proper sequence order
      starting from 1 & up...

      the reason do not have it as an auto increament field for there can be 2 same mtrl_nos as
      mtrl_no: 1 - lot: A ( lot no: `A` is a default for a new material no.) mtrl_no: 1 lot: B & require the calculated field as 1A 1B


      i tried replacing the 1 to 000001 & 000002 & so on but that did not help i still get 000100 after 000010.. still have not reached 000200 but i presume this record will be displaced after 000020.

      i presume changing to numeric field seems the only choice though i am sure there must be a way as then will have to amend over 18 reports.

      PADL function - i think will not help as zeros are added manually and manual entry is not bothersome as just one record will be created maybe every alternate day though as started this table now so entered 148 records in one go & found this problem..

      v.p



      Comment


      • #4
        RE: numbering a character field in sequence

        Possibly it would help to revise your index definition for this field, so that it's based on the numeric value of the character string.

        Check out the val() function at pg 488 of the xbasic ref. manual.

        -- tom

        Comment


        • #5
          RE: numbering a character field in sequence

          add a field to the database called sort.(or any name that you want)
          Define as a calculated field
          define expression as sort = val(matl_no)
          define all of your browses and reports to order by the sort field and then any other fields that you need.
          Charlie Crimmel

          Comment


          • #6
            RE: numbering a character field in sequence

            VP:

            If the field is fully padded with leading zeroes, it will sort correctly - 11 will follow 10 and 100 will follow 99. If #'s are properly padded and it's still not sorting correctly then you have an index problem. However, it's my experience that users, no matter HOW diligent, can't always get the leading zeroes correct. You need to take that out of their hands. No, I don't think it should be at all necessary to change to a numberic field.

            I would suggest that you set up some code on the "On Write" field event if the #'s are being entered in a form field or in field rules if in a browse, that does the padding. You probably also need a lookup/popup to show what #'s are already in the system. Then you tell the users to enter ONLY the number and NEVER the leading zeroes and let the event control the padding. Something like this on the On Write

            num_in=alltrim(this.text)
            if left(num_in,1)="0" 'don't let them enter zeroes
            cancel()
            this.text=""
            this.refresh()
            ui_msg_box("ENTER", "Only the numbers. No leading zeroes")
            end if
            num_in=padl(num_in,6,"0") 'if it's a 6 character field
            this.text=num_in
            this.refresh()

            You may also need to run an update operation on the field to make sure that all existing values are properly padded something like

            If(alltrim(number_field)"",padl(val(alltrim(number_field)),6,"0"),number_field)

            should work for a 6 character field in an operation. Remember, backup before any update!

            Finian

            Finian

            Comment


            • #7
              RE: numbering a character field in sequence

              Oops, that update expression should be

              if(alltrim(number_field)"",padl(alltrim(ltrim(str(val(alltrim(number_field))))),6,"0"),number_field)


              Finian
              Finian

              Comment


              • #8
                RE: numbering a character field in sequence

                thanks guys,

                changing the index expression to

                val(trim(mtrl_no))

                did the job well. hope it stays that way..

                thanks again .. this board is really helpful.

                v.p

                Comment


                • #9
                  RE: numbering a character field in sequence

                  V.P.

                  Call me a purist, but I still think you should verify the padding and then take the padding out of the user's hands. Converting a character field to a number to get a correct sort makes me think that somthing is wrong with the data. Properly padded, the character field MUST sort properly.

                  Finian
                  Finian

                  Comment

                  Working...
                  X