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

Help with WORD()

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

    Help with WORD()

    The docs state this:

    Character Output_String = WORD( Input_String as C, Word_Number as N [, Word_Delimiter as C [, Word_Count as N ]] )
    I can usually figure out the parameters from the docs and testing, but I can't get this one.

    ? word("now is the time for all good men to come to the aid of the country",2,"time",3)
    = " for all good men to come to the aid of the country"?

    word("now is the time for all good men to come to the aid of the country",4,"time",3)
    = ""
    I am having problems understanding what the second parameter qualifies. Any help is appreciated.

    Mike W
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

    #2
    Re: Help with WORD()

    Mike, This page includes explanation. Where in the docs were you looking?
    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


      #3
      Re: Help with WORD()

      Tim,

      Thanks for responding. That is where I was looking. But I can't figure it out I guess I need some more prosaic ( wordy ) explanation of what the second parameter is supposed to contribute because I can't figure it out with the DOCs and many IW tries to sort it out.

      Mike W
      Mike W
      __________________________
      "I rebel in at least small things to express to the world that I have not completely surrendered"

      Comment


        #4
        Re: Help with WORD()

        Output_String = WORD( Input_String as C, Word_Number as N [, Word_Delimiter as C [, Word_Count as N ]] )
        I'll try.

        The word function takes the string (Input_String) and divides it up into seperate 'words' (little pieces of the original) using the Word_Delimiter as the dividing point. The Word_Number together with the Word _count tells the function which bits of the original you want. If you set Word_Number to 2 and don't use Word_Count you will get the second piece. If you set Word_Number to 2 and set Word_Count to 3 you will get the three pieces ('words') starting with the second 'word'. If you set Word_Number to -2 then you will get the second last piece.

        ? word("now is the time for all good men to come to the aid of the country",2,"time",3)
        = " for all good men to come to the aid of the country"?
        In your example you are telling the function to use "Time' as the delimiter.
        This gives you two pieces "now is the " and " for all good men to come to the aid of the country"

        You then tell it to give you three pieces starting at the second piece.

        The second piece is " for all good men to come to the aid of the country". And there aren't any more so that is all you get.

        Follow?
        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: Help with WORD()

          It depends what you want to achieve of course. In normal instances the word delimiter is a space character, " ". I cannot work out what using "time" as a delimiter would produce by way of a meaningful result. If you want to locate the occurrence of one string in another you should perhaps use another function such as atc().

          Comment


            #6
            Re: Help with WORD()

            Tim/Brett,

            Thanks, I believe I understand it better, now. Although, it still doesn't make sense that the delimiter, which seems to mark the end of the WORD string is included in the string UNLESS it delimits the last string requested, then it is not included.

            Mike W
            Mike W
            __________________________
            "I rebel in at least small things to express to the world that I have not completely surrendered"

            Comment


              #7
              Re: Help with WORD()

              Mike:
              I am not sure if you are doing this deliberately or by mistake. If deliberately, it's rather an innovative way for the use of word() and it is doing what you are telling it to do:

              In your example, you are using a word as a separator. That's rather unusual. Typically, a separator would be a comma, a space, a semicolon etc. But nonetheless alpha obliged:

              dim x as c
              x="now is the time for all good men to come to the aid of the country, for time will tell"
              ?word(x,2,"time",2)
              = " for all good men to come to the aid of the country, for time will tell"

              alpha treated each block of characters between "time" as a word.
              You are asking alpha to extract the second & third words. It did.
              The first word after the separator is:
              for all good men to come to the aid of the country, for time
              The second:
              will tell

              Comment


                #8
                Re: Help with WORD()

                If

                alpha treated each block of characters between "time" as a word
                then "time" could never appear in the output.

                "now is the time for all good men to come to the aid of the country, for time will tell"

                Separators in red, possible words in blue.
                There can be only one.

                Comment


                  #9
                  Re: Help with WORD()

                  Stan:
                  No different than if you'd used any other separator...

                  x="now is the, time for all, good men to come to the aid of the country, for time will tell"
                  ?word(x,2,",",2)
                  = " time for all, good men to come to the aid of the country"

                  x="now is the; time for all; good men to come to the aid of the country, for time will tell"
                  ?word(x,2,";",2)
                  = " time for all; good men to come to the aid of the country, for time will tell"

                  The name word() is misleading. alpha treats all blocks of charachters between the separator as one word. When you choose more than one word, the separator is included in the output.
                  Didn't you read that in the help file!
                  Last edited by G Gabriel; 11-24-2006, 06:06 PM.

                  Comment


                    #10
                    Re: Help with WORD()

                    Gabriel,

                    The name word() is misleading. alpha treats all blocks of charachters between the separator as one word. When you choose more than one word, the separator is included in the output.
                    Didn't you read that in the help file!
                    Code:
                    x="now is the time, of all time, for all good men to come to the aid of the country, for time will tell"
                    ?word(x,2,"time",2)
                    = ", of all time, for all good men to come to the aid of the country, for "
                    I agree with you the use of WORD is misleading. Tim and your descriptions certainly more understandable than the description in the docs. I guess a nuance of the code is that while the code has nothing but 2 in the command, if what you wrote (in red) was true, then "time" should be included 2 times. Yet only 1 "time" is contained in the output. None-the-less, I understand the nuance of the function now and can make due as needed. Thanks for you help.

                    Mike W
                    Mike W
                    __________________________
                    "I rebel in at least small things to express to the world that I have not completely surrendered"

                    Comment


                      #11
                      Re: Help with WORD()

                      A real world example of using different delimiters may help:

                      tlist = table.external_record_content_get("tablename","ID+' -- '+trim(Address)+' -- '+trim(city)","ID")

                      would return a multiline crlf string something like this
                      1234 -- 123 First St. -- St. Louis
                      2345 -- PO Box 3456 -- San Francisco
                      3456 -- 987 Pontiac Trail; suite 34 -- Detroit

                      Now, you can get specific lines such as retrieving line 2 with:
                      this_line = word( tlist, 2, crlf())
                      where the delimiter is the crlf at the end of each line.
                      The result would be:
                      2345 -- PO Box 3456 -- San Francisco

                      Then get the address on line 2 with:
                      address = word( this_line, 2, " -- " )
                      The result would be:
                      PO Box 3456

                      Comment


                        #12
                        Re: Help with WORD()

                        Cal,
                        Thanks, and yes.. having come to learn the use of Word() I sent this morning an answer to Andy Meer in the following thread that used the same approach that you just gave as an example.

                        http://msgboard.alphasoftware.com/al...ad.php?t=64142

                        I had a little trouble with the crlf() delimiter so I converted it to commas (now seeing this unnecessary).

                        Cal, do you know how to dim the multi-select Xdialog variable so the List Box appears unselected. I read a thread you posted back in 2003 that Dr. Wayne answered your question regarding converting the variable into a non-session variable, but I'm thinking there must be a simple method to cancel out the Xdialog selection variable so the dialog returns a FRESH list, unhighlighted.

                        Mike W
                        Mike W
                        __________________________
                        "I rebel in at least small things to express to the world that I have not completely surrendered"

                        Comment


                          #13
                          Re: Help with WORD()

                          Mike:
                          Yet only 1 "time" is contained in the output
                          Speaking of nauance:
                          If you ask for one word, alpha gives you the one between the separators. If you ask for more than one, in your example 2, alpha gives you the first one, the separator & the second one. Hence, the separator appeared once.

                          Ask for three, and the separator will appear twice, as in:
                          dim x as c
                          x="now is the time, of all time, for all good men to come to the aid of the country, for time will tell"
                          ?word(x,2,"time",3)
                          = ", of all time, for all good men to come to the aid of the country, for time will tell"

                          Comment


                            #14
                            Re: Help with WORD()

                            Gabriel,

                            gives you the one between the separators
                            Excellent! Yes, the key concept (of which seemed to be totally escaping me) being BETWEEN! Thanks.

                            Mike W
                            Mike W
                            __________________________
                            "I rebel in at least small things to express to the world that I have not completely surrendered"

                            Comment


                              #15
                              Re: Help with WORD()

                              Re: how to dim the multi-select Xdialog variable so the List Box appears unselected

                              I guess I'm not really sure I understand the question. If the choice variable is empty to start with, I don't believe anything should appear selected.

                              I'm not sure this is what you are talking about but here's what I would do.

                              Code:
                              input_list = <<%list%
                              1234 -- 123 First St. -- St. Louis
                              2345 -- PO Box 3456 -- San Francisco
                              3456 -- 987 Pontiac Trail; suite 34 -- Detroit
                              %list%
                               
                              dlg_text = <<%dlg%
                              {ysize=.3}{units=F}{sp};
                              {font=ms sans serif,8,b}Select Addresses:{font=ms sans serif,8,n};
                              [%m%.50,5chc^#input_list];
                              {line=1,0};
                              <*15OK> <15Cancel>
                              %dlg%
                               
                              DIM dlg_result as C
                              dlg_result = ui_dlg_box( "", dlg_text)

                              Comment

                              Working...
                              X