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

A survey on ALLTRIM as a Pain in the neck

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

    A survey on ALLTRIM as a Pain in the neck

    I'm new as you know, but I have never had any program platform in recent memory pad character elements by default.
    I can't even remember when I would want a padded character or numeric value.

    So, I'm wondering why the default of most character strings such as fields and str(###) were ever set as padded?

    Is it true that the default padding on most every occasion of string values or numerics (left-padded) is a Pain in the neck?
    If so, is ALLtrim(), Ltrim() Rtrim() the most used functions in A5?
    If so, why does A5 keep this default format?
    What am I missing?
    Does an application bulging with xxxtrim()'s slow it down?
    First Love

    #2
    Re: A survey on ALLTRIM as a Pain in the neck

    why the default of most character strings such as fields and str(###) were ever set as padded?
    Has nothing to do with padding per se by Alpha. The table structure used the the Foxpro (2.6 I believe) format. That format stores the data in fixed width fields.

    I suppose a complete rewrite of the desktop portion of Alpha to use some other storage basis is possible, but not likely.
    There can be only one.

    Comment


      #3
      Re: A survey on ALLTRIM as a Pain in the neck

      The Foxpro format Alpha Five uses is a direct descendant of an earlier format created by Ashton Tate for a product called dBase, one of the first widely available relational database systems. DBF files have been using fixed width fields 25 or 30 years. Fixed width fields mean fixed width records. Understanding the ramifications of this is part of the learning curve with Alpha Five and any other product that uses fixed width records.

      Comment


        #4
        Re: A survey on ALLTRIM as a Pain in the neck

        One can also use the - operator to trim trailing blanks. See this page in the help
        I have never had a problem using it. Not sure on the performance issue. (another one of those things I need to test with Ira's utility).
        The reason str() is padded on the left is - from the help.
        STR() converts a Number to a right-justified character string.
        To get a non left padded character from a numeric you can also use Alpha's automagical type conversion as described here.
        eg
        Code:
        ?str(123)
        = "       123"
        
        ?""+123
        = "123"
        
        ?"Qty is " + 123
        = "Qty is 123"
        I realize this is a v9 forum but here is a quote from the Whats new in v10 about a new xbasic method.
        .Data() Method On DBF Tables and Property Variables

        When using AlphaDAO, the method used to read data from a resultset is <resultset>.data("columnname")
        In order to make it easier to write Xbasic code that will work the same when iterating over a DBF table, or a SQL resultset, or a property variable, the .data() method is now supported for both DBF tables and property variables.
        For example:
        t = table.open("customer")
        ?t.lastname
        = "Smith "
        ?t.data("lastname")
        = "Smith"

        Notice that the <tbl>.data() method trims trailing blanks on character fields.

        dim p as p
        p.firstname = "Frank"
        ?p.data("firstname")
        = "Frank"
        The example using Smith actually has many more trailing blanks but the forum quote feature trimmed them (ironic), but you get the idea.
        Tim Kiebert
        Eagle Creek Citrus
        A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

        Comment


          #5
          Re: A survey on ALLTRIM as a Pain in the neck

          Here are some times courtesy of Ira's Code Utility

          Code:
          ltrim(str(123))   '.000075117371 seconds
          ""+123            '.000077190179 seconds
          
          alltrim("aaa   ") '.000062034381 seconds
          "aaa   " - ""     '.000061815691 seconds
          As you can see there is not much in it.
          Tim Kiebert
          Eagle Creek Citrus
          A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

          Comment


            #6
            Re: A survey on ALLTRIM as a Pain in the neck

            OK,
            So, instead of:
            ?rtrim(CUSTOMER->ADDR) + ltrim(str(208))
            = "PO BOX 96208"

            I just use:
            ?CUSTOMER->ADDR - "" +208
            = "PO BOX 96208"

            Trivia: A child of InFormix
            What I was used to was:
            ?CUSTOMER.ADDR | str(208) (no space bet.)
            = "PO BOX 96208"

            and:
            ?CUSTOMER.ADDR & str(208) (1 space bet.)
            = "PO BOX 96 208"
            Last edited by SMARTII; 11-17-2009, 08:02 PM.
            First Love

            Comment


              #7
              Re: A survey on ALLTRIM as a Pain in the neck

              Ok, while you're at it:
              Try raw "abc"+str(123)

              and raw:
              Yourtable->any_char_Fld + str(123)
              Even though you get the pads.

              Originally posted by Tim Kiebert View Post
              Here are some times courtesy of Ira's Code Utility

              Code:
              ltrim(str(123))   '.000075117371 seconds
              ""+123            '.000077190179 seconds
               
              alltrim("aaa   ") '.000062034381 seconds
              "aaa   " - ""     '.000061815691 seconds
              As you can see there is not much in it.
              First Love

              Comment


                #8
                Re: A survey on ALLTRIM as a Pain in the neck

                raw "abc"+str(123) was .000076824565

                I could not run Yourtable->any_char_Fld + str(123). For some reason the utility did not like accessing a table that way.

                But
                Code:
                t=table.open("customer")
                t.persist()
                
                ?t.LASTNAME + str(123)   [B][COLOR=Blue] 'and only timing this line was .00018009446[/COLOR][/B]
                = "Graham                     123"
                Tim Kiebert
                Eagle Creek Citrus
                A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                Comment


                  #9
                  Re: A survey on ALLTRIM as a Pain in the neck

                  RE:
                  "..from the What's new in v10 about a new xbasic method."...
                  Tim,
                  Thanks!!!!
                  Because, I tried it in V9:
                  Ex:
                  FUNCTION notpadded AS C ()
                  t = table.open("CUSTOMER")
                  notpadded = t.data("ADDR")+125

                  END FUNCTION
                  ---------------
                  ?notpadded()
                  = "PO BOX 96125"

                  One More:
                  FUNCTION notpadded AS C ()
                  t = table.open("CUSTOMER")
                  notpadded = t.data("Name") + ", " + t.data("city") + ", " + t.data("zip")
                  END FUNCTION

                  ?notpadded()
                  = "1ST AMERICAN BANK TEXAS, AZLE, 76098"

                  WELCOME TO V9.10
                  Originally posted by Tim Kiebert View Post
                  One can also use the - operator to trim trailing blanks. See this page in the help
                  I have never had a problem using it. Not sure on the performance issue. (another one of those things I need to test with Ira's utility).
                  The reason str() is padded on the left is - from the help.To get a non left padded character from a numeric you can also use Alpha's automagical type conversion as described here.
                  eg
                  Code:
                  ?str(123)
                  = "       123"
                   
                  ?""+123
                  = "123"
                   
                  ?"Qty is " + 123
                  = "Qty is 123"
                  I realize this is a v9 forum but here is a quote from the Whats new in v10 about a new xbasic method.The example using Smith actually has many more trailing blanks but the forum quote feature trimmed them (ironic), but you get the idea.
                  First Love

                  Comment


                    #10
                    Re: A survey on ALLTRIM as a Pain in the neck

                    Well what do you know. :)

                    I found this in the patch realease notes for v9
                    <Tbl>.data() Method. Table objects now have a new method to read data from the table. <tbl>.data(fieldname) gets the value of the specified field from the current record.
                    t = table.open("customer")
                    ui_msg_box("",t.data("firstname"))

                    'The above code is a shortcut for this:
                    t = table.open("customer")
                    f = t.field_get("firstname")
                    ui_msg_box("",f.value_get())
                    And on finding this my ailing (failing) memory thinks it may have seen it there first. :o
                    I guess may be the new bit for v10 is that it is also supported for property variables. But may be you can test that as well and prove me wrong . And then you will have a v9.10. :)
                    Last edited by Tim Kiebert; 11-17-2009, 08:57 PM. Reason: spelling
                    Tim Kiebert
                    Eagle Creek Citrus
                    A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                    Comment


                      #11
                      Re: A survey on ALLTRIM as a Pain in the neck

                      Just the opposite of what you might expect??
                      No formatting = Longer?
                      Or did you try formatting from a table field?

                      Originally posted by Tim Kiebert View Post
                      raw "abc"+str(123) was .000076824565

                      I could not run Yourtable->any_char_Fld + str(123). For some reason the utility did not like accessing a table that way.

                      But
                      Code:
                      t=table.open("customer")
                      t.persist()
                       
                      ?t.LASTNAME + str(123)   [B][COLOR=blue]'and only timing this line was .00018009446[/COLOR][/B]
                      = "Graham                     123"
                      First Love

                      Comment


                        #12
                        Re: A survey on ALLTRIM as a Pain in the neck

                        This is reading from a table which requires a disk read ( or maybe at least a cache read)
                        t.LASTNAME + str(123) was .00018009446
                        which should be pretty much the same as - Yourtable->any_char_Fld + str(123)

                        And this is not
                        "abc"+str(123) was .000076824565
                        Tim Kiebert
                        Eagle Creek Citrus
                        A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                        Comment


                          #13
                          Re: A survey on ALLTRIM as a Pain in the neck

                          I have nothing in my memory..failing or otherwise..
                          So,
                          Give me an example that would qualify.
                          ps.
                          Just so you know:
                          data() is nowhere to be found in the V9 HELP (Search or Index).
                          Of course same for my V10 Help..nowhere..

                          Originally posted by Tim Kiebert View Post
                          Well what do you know. :)

                          I found this in the patch realease notes for v9
                          And on finding this my ailing (failing) memory thinks it may have seen it there first. :o
                          I guess may be the new bit for v10 is that it is also supported for property variables. But may be you can test that as well and prove me wrong . And then you will have a v9.10. :)
                          Last edited by SMARTII; 11-17-2009, 09:53 PM.
                          First Love

                          Comment


                            #14
                            Re: A survey on ALLTRIM as a Pain in the neck

                            data() is nowhere to be found in the V9 HELP
                            Not in the help files (reason why Tim looked in the release notes and What's New areas).... but does come up in the code/interactive editors.

                            Help for parts of v8, v9, v10 are now in those 3 places....4 counting this messageboard!
                            Mike
                            __________________________________________
                            It is only when we forget all our learning that we begin to know.
                            It's not what you look at that matters, it's what you see.
                            Henry David Thoreau
                            __________________________________________



                            Comment


                              #15
                              Re: A survey on ALLTRIM as a Pain in the neck

                              Give Alpha + SQL Server Express a try.
                              Frank R

                              Comment

                              Working...
                              X