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

How to stuff() a string

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

    How to stuff() a string

    I'm having trouble building a new string. My existing function is:

    FUNCTION prtline1 AS C (prname AS C, prspouse AS C, prdeceased AS C )
    'stuff Name --- Spouse --- Deceased
    prtline1 = stuff(prtline1,1,40,alltrim(prname))
    prtline1 = stuff(prtline1,45,10,alltrim(prspouse))
    prtline1 = stuff(prtline1,89,8,alltrim(prdeceased))
    END FUNCTION

    My goal is have the prname start in string position #1; prspouse starting in string position #45, prdeceased starting in string position #89...etc.

    This function puts the proper data into the string, but it misses the "spaces" between entries. For example if the prname is George and the prspouse is Rita, the function shows "GeorgeRita" not "George...space to character 45...Rita"

    Any idea how to modify this function so the characters start as the specified string positions rather then next to each other?

    #2
    Re: How to stuff() a string

    Code:
    FUNCTION prtline1 AS C (prname AS C, prspouse AS C, prdeceased AS C )
    	'stuff Name --- Spouse --- Deceased
     prtline1 = space(98)	'start with something to stuff
     prtline1 = stuff(prtline1,1,40,alltrim(prname))
     prtline1 = stuff(prtline1,45,10,alltrim(prspouse))
     prtline1 = stuff(prtline1,89,8,alltrim(prdeceased)) 
    END FUNCTION
    Last edited by Stan Mathews; 03-28-2016, 12:37 PM. Reason: simplified
    There can be only one.

    Comment


      #3
      Re: How to stuff() a string

      Stan,

      Your code:
      ---------
      FUNCTION prtline1 AS C (prname AS C, prspouse AS C, prdeceased AS C )
      'stuff Name --- Spouse --- Deceased
      prtline1 = stuff(prtline1,1,40,alltrim(prname))+space(4)
      prtline1 = stuff(prtline1,45,10,alltrim(prspouse))+space(33)'not sure if 33 is right
      prtline1 = stuff(prtline1,89,8,alltrim(prdeceased))
      END FUNCTION
      ---------

      Gets me closer...I'm playing with it to see if I can find a combination that works...in your example, the spouse does start 4 spaces to the right of the name, but not far enough to "match" what I'm trying to duplicate...I may be able to just add spaces to move it exactly where I want...I'll let you know.

      Thanks for your help.

      Jack

      Comment


        #4
        Re: How to stuff() a string

        Originally posted by Stan Mathews View Post
        Code:
        FUNCTION prtline1 AS C (prname AS C, prspouse AS C, prdeceased AS C )
        	'stuff Name --- Spouse --- Deceased
         prtline1 = space(98)	'start with something to stuff
         prtline1 = stuff(prtline1,1,40,alltrim(prname))
         prtline1 = stuff(prtline1,45,10,alltrim(prspouse))
         prtline1 = stuff(prtline1,89,8,alltrim(prdeceased)) 
        END FUNCTION
        I'm getting better positioning results with zero as the 3rd argument/parameter.....

        Code:
        FUNCTION prtline1 AS C (prname AS C, prspouse AS C, prdeceased AS C )
        	'stuff Name --- Spouse --- Deceased
         prtline1 = space(98)	'start with something to stuff
         prtline1 = stuff(prtline1,1,0,alltrim(prname))
         prtline1 = stuff(prtline1,45,0,alltrim(prspouse))
         prtline1 = stuff(prtline1,89,0,alltrim(prdeceased)) 
        END FUNCTION
        (Never used that function before.. or remember seeing it..)
        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


          #5
          Re: How to stuff() a string

          Al,

          That code works fine...better than the previous. I did find that I had to increase the "space" numbers significantly to get the starts where I wanted. I'm guessing it's to do with spaces not being uniform in size when working with fonts that are not "fixed length."

          At any rate, the code works fine...thanks for the help everyone!

          Comment


            #6
            Re: How to stuff() a string

            Originally posted by jackp_MDB View Post
            Al,

            That code works fine...better than the previous. I did find that I had to increase the "space" numbers significantly to get the starts where I wanted. I'm guessing it's to do with spaces not being uniform in size when working with fonts that are not "fixed length."

            At any rate, the code works fine...thanks for the help everyone!
            To do what you are doing without using fixed length(width) fonts is a head/heartache.

            Tell us where you are implementing this.
            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


              #7
              Re: How to stuff() a string

              I'm developing this to track a detailed listing of personnel...as usual, some data is missing from the existing entries. Problem I'm trying to solve is to stop "printing" empty lines.

              For example, I may have only your First and Last names...My "full" report contains potentially 4 lines that include spouse, deceased, military service, address lines, city, state, etc...etc...

              I have individual fields printing as I want, but my idea is to copy those fields into a report line that contains all info assigned to that line...then that line is empty, I can skip including it in the record.

              Hope this hasn't confused the issue.

              Jack

              Comment


                #8
                Re: How to stuff() a string

                Originally posted by jackp_MDB View Post
                I'm developing this to track a detailed listing of personnel...as usual, some data is missing from the existing entries. Problem I'm trying to solve is to stop "printing" empty lines.

                For example, I may have only your First and Last names...My "full" report contains potentially 4 lines that include spouse, deceased, military service, address lines, city, state, etc...etc...

                I have individual fields printing as I want, but my idea is to copy those fields into a report line that contains all info assigned to that line...then that line is empty, I can skip including it in the record.

                Hope this hasn't confused the issue.

                Jack
                hmmmm.. It confuses me that you need to the data positioned to test if the line is blank.

                There are options on a report for a region to 'shrink' - ie blank lines are eliminated.

                or conditional objects or filter (select) records only in certain conditions.

                Are projects fun???
                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


                  #9
                  Re: How to stuff() a string

                  Sorry about the confusion...and yes...projects are always fun until you figure them out...then it's "old hat!"

                  Thanks for the help.

                  Jack

                  Comment


                    #10
                    Re: How to stuff() a string

                    one other thing to try is soft return.
                    if you have a field on a line by itself and that line was fed with a soft return and when the data is not present the line feed does not happen
                    and you won't see an empty line.
                    thanks for reading

                    gandhi

                    version 11 3381 - 4096
                    mysql backend
                    http://www.alphawebprogramming.blogspot.com
                    [email protected]
                    Skype:[email protected]
                    1 914 924 5171

                    Comment


                      #11
                      Re: How to stuff() a string

                      Originally posted by GGandhi View Post
                      one other thing to try is soft return.
                      if you have a field on a line by itself and that line was fed with a soft return and when the data is not present the line feed does not happen
                      and you won't see an empty line.
                      Gandhi

                      You are talking about using a Rich Text Field.

                      Good thought.
                      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


                        #12
                        Re: How to stuff() a string

                        My goal is have the prname start in string position #1; prspouse starting in string position #45, prdeceased starting in string position #89...etc.
                        this also you can try to achieve the above
                        dim printLine as c
                        printLine = padr(prname,44," ")+padr(prspouse,44," ")+padr(predeceased ,44," ")
                        thanks for reading

                        gandhi

                        version 11 3381 - 4096
                        mysql backend
                        http://www.alphawebprogramming.blogspot.com
                        [email protected]
                        Skype:[email protected]
                        1 914 924 5171

                        Comment


                          #13
                          Re: How to stuff() a string

                          My final solution was to replace all report fields with "rich text" fields.

                          Using rich text and soft returns, alpha5 handles the empty field issues automatically and I do not have to worry about checking and substituting fields when needed.

                          Gandhi remarks about soft returns, and a bit of time with Al, things finally cleared up.

                          Thanks for the help and getting me turned around to the easy way to do things...

                          Comment


                            #14
                            Re: How to stuff() a string

                            Originally posted by jackp_MDB View Post
                            My final solution was to replace all report fields with "rich text" fields.

                            Using rich text and soft returns, alpha5 handles the empty field issues automatically and I do not have to worry about checking and substituting fields when needed.

                            Gandhi remarks about soft returns, and a bit of time with Al, things finally cleared up.

                            Thanks for the help and getting me turned around to the easy way to do things...
                            Jack

                            Thanks for sharing the solution and thanks for your service to the country.
                            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

                            Working...
                            X