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

stritran help

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

    stritran help

    I am trying to change several choices from a multi-list box to produce this:
    Right Hip, Left Knee, Left Foot and Right Hand

    this:
    stritran(Var->vLocation,crlf(),", ") produces this:
    Right Hip, Left Knee, Left Foot, Right Hand,

    and this:
    stritran(vLocation,","," and",w_count(vLocation,", ")-1,1) produces this:
    Right Hip
    Left Knee
    Left Foot
    Right Hand

    I thought the second example would work, so not sure what I'm doing wrong. Thanks!

    Don

    #2
    Re: stritran help

    Don,

    Just did a quick look at list processing functions and maybe crlf_to_comma would work for you.

    http://support.alphasoftware.com/alp...TO_COMMA().htm

    I'll look a bit more as am imagining there are many ways to accomplish your need.

    Rtrim() should do it also to get rid of the trailing comma.

    http://support.alphasoftware.com/alp...ns/RTRIM().htm
    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


      #3
      Re: stritran help

      Code:
      if(w_count(crlf_to_comma(vLocation),",")>1,strtran(stuff(crlf_to_comma(vLocation),at(",",crlf_to_comma(vLocation),-1),1," and "),",",", "),crlf_to_comma(vLocation))
      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


        #4
        Re: stritran help

        Let's make life simple:
        tagged_pattern("1,2,3,4","1, 2, 3and 4",crlf_to_comma(vLocation))

        Comment


          #5
          Re: stritran help

          Gabe,

          would tagged_pattern be able to handle a variable number of elements. In Don's first post he mentioned that the input is from a multi-list box so I'm thinking the number of elements isn't fixed.
          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: stritran help

            Tim, I think you've got a good point. The 'devil is in the details', isn't it?

            Comment


              #7
              Re: stritran help

              :D many ways.

              Wondering why this was not used seeing as he had almost produced what he wanted with

              stritran(Var->vLocation,crlf(),", ") produces this:
              Right Hip, Left Knee, Left Foot, Right Hand,
              Except that it left the trailing comma.

              So would think...

              Code:
              Rtrim(stritran(Var->vLocation,crlf(),", "),"," )
              would produce this:
              Right Hip, Left Knee, Left Foot, Right Hand

              Guess we'll have to wait and see which Don needs to use.
              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


                #8
                Re: stritran help

                When I ran into a similar need, I reversed the string, changed the first comma to "dna " and reversed it back. That allowed me to change only the last comma in the string.
                Code:
                cStr = "Right Hip, Left Knee, Left Foot, Right Hand"
                
                cStr = *reverse(strtran(*reverse(cStr),",","dna ",1,1))
                
                ?cStr
                = "Right Hip, Left Knee, Left Foot and Right Hand"
                My 2 cents,
                Steve

                Comment


                  #9
                  Re: stritran help

                  Thanks to all for your help. Here is what I found:

                  I went with Tim Kiebert's code:
                  if(w_count(crlf_to_comma(vLocation),",")>1,strtran(stuff(crlf_to_comma(vLocation),at(",",crlf_to_comma(vLocation),-1),1," and "),",",", "),crlf_to_comma(vLocation))
                  which produced the desired result: Left Hand, Right Elbow and Left Elbow

                  Gabe's code:
                  tagged_pattern("1,2,3,4","1, 2, 3and 4",crlf_to_comma(vLocation))
                  produced this: Right Elbow, Left Elbow, Left Handand
                  ... would work if I always chose 4 from the list.

                  MikeC's code:
                  Rtrim(stritran(Var->vLocation,crlf(),", "),"," )
                  produced this: Left Hand, Right Elbow, Left Elbow
                  ... which could easily work. I was looking for a way to say "AND" the last item chosen (instead of the comma). The 'devil is in the details'

                  Steve Andrew's code:
                  *reverse(strtran(*reverse(cStr),",","dna ",1,1)) produced this for me:
                  Left Hand
                  Right Elbow
                  Left Elbow
                  Not sure what I did wrong to produce these results.

                  Thanks again to all. I am sure I would not be able to accomplish this without help from this forum.

                  Comment


                    #10
                    Re: stritran help

                    Originally posted by djldc View Post
                    I am trying to change several choices from a multi-list box to produce this:
                    Right Hip, Left Knee, Left Foot and Right Hand
                    I live with an English teacher.

                    Wouldn't the correct grammatic form be: Right Hip, Left Knee, Left Foot, and Right Hand
                    Al Buchholz
                    Bookwood Systems, LTD
                    Weekly QReportBuilder Webinars Thursday 1 pm CST

                    Occam's Razor - KISS
                    Normalize till it hurts - De-normalize till it works.
                    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                    When we triage a problem it is much easier to read sample systems than to read a mind.
                    "Make it as simple as possible, but not simpler."
                    Albert Einstein

                    http://www.iadn.com/images/media/iadn_member.png

                    Comment


                      #11
                      Re: stritran help

                      Al,

                      Wow! And I think that I date myself with older ways!!! :D

                      The rule used to be the way you use... but I remember when that rule was sort of dropped about 35 or so years ago back when I was I believe in 7th grade!


                      ----yeah I know--my kids are waiting for my darn memory to go too!!
                      Last edited by MikeC; 11-09-2007, 01:39 PM. Reason: more info
                      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


                        #12
                        Re: stritran help

                        Originally posted by MikeC View Post
                        Al,

                        Wow! And I think that I date myself with older ways!!! :D

                        The rule used to be the way you use... but I remember when that rule was sort of dropped about 35 or so years ago back when I was I believe in 7th grade!
                        It may have been dropped at your school, but it wasn't dropped at my wife's classroom today..

                        You're not in Hortonville are you? Are the teachers there still on strike??? (35 years ago...) ;)
                        Al Buchholz
                        Bookwood Systems, LTD
                        Weekly QReportBuilder Webinars Thursday 1 pm CST

                        Occam's Razor - KISS
                        Normalize till it hurts - De-normalize till it works.
                        Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                        When we triage a problem it is much easier to read sample systems than to read a mind.
                        "Make it as simple as possible, but not simpler."
                        Albert Einstein

                        http://www.iadn.com/images/media/iadn_member.png

                        Comment


                          #13
                          Re: stritran help

                          Tim:

                          would tagged_pattern be able to handle a variable number of elements.
                          No.
                          It would, with a script though.

                          Mike:
                          Code:
                          Rtrim(stritran(Var->vLocation,crlf(),", "),"," )
                          will eleminate the trailing comma, but does not insert "and".

                          Steve:

                          Don is starting with a crlf list.
                          Last edited by G Gabriel; 11-09-2007, 01:59 PM.

                          Comment


                            #14
                            Re: stritran help

                            Al,

                            There ya go--makes sense in seeing as a large part my early schooling was in a larger city as opposed to a rural area...seems like cities and generally non-rural areas try to change so many things that were just fine without being changed. Some caught on and others didn't .

                            But guess both ways are "correct" now-a-days. Sort of like you can no longer say "Ain't ain't a word because ain't ain't in the dictionary" like many people used to iterate when I was younger...some things should not change.

                            ===========================
                            Gabe,

                            Yeah I realized I missed the boat on the "and"--simply did not see it!! :)
                            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: stritran help

                              Originally posted by djldc View Post
                              Steve Andrew's code:
                              *reverse(strtran(*reverse(cStr),",","dna ",1,1)) produced this for me:
                              Left Hand
                              Right Elbow
                              Left Elbow
                              Not sure what I did wrong to produce these results.
                              Don,

                              My code was intended for a comma-delimited list. Apparently, you used my expression with a CRLF-delimited list. An expansion of my expression which would take a CRLF-delimited list and produce the desired string would be:
                              Code:
                              ?cStr
                              = Right Hip
                               Left Knee
                               Left Foot
                               Right Hand
                              
                              cStr = *reverse(strtran(*reverse(strtran(cStr,crlf(),",")),",","dna ",1,1))
                              
                              ?cStr
                              = "Right Hip, Left Knee, Left Foot and Right Hand"

                              Al,

                              If it would be correct to say "A, B, C, and D" that is completely new to me. It's definitely not the way I was taught nor the way I see it in publications. But things change over times.

                              Comment

                              Working...
                              X