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

Extract word from one field to another

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Extract word from one field to another

    Ok I have searched the forum for this answer - I know its here because there was a thread that got me this far but now I can't find it.

    I have a field "keylink" it's the field I created so I can do a ref integrity on the set.

    I've got the keylink to work, the field rule combines 3 other fields into one with a plus sign between each field data.

    "Jobnumber"+"Lineitem"+"PurchaseOrder"
    ex.
    07-J115+001+25681178

    The purchase order and lineitem characters may vary, they could contain 3 characters or 11 from record to record.

    My child record gets the keylink data correctly, now I need it to be separated into its corresponding fields in the child dbf. So Jobnumber part of field goes to the job number field, Lineitem data from the keylink goes into the lineitem field, PurchaseOrder data from the keylink goes into the PurchaseOrder field.

    I have used this expression in the field rule for "JobNumber"
    ?word(keylink,1,+)
    If I understand this expression correctly it should work as this - since keylink is the field I'm looking in, and the word I want to extract is the first word (1), and the delimiter is the + I should get just the jobnumber 07-J115 to populate the jobnumber field

    Instead I can't even get that far - it's not a good expression. What "),.' am I missing?

    Thanks in advance for the help. If need further info let me know.

    #2
    Re: Extract word from one field to another

    The ? is used in the interactive editor to display the result of the expression, ? is short for print.

    word(keylink,1,"+")

    should yield the first word in the keylink field.

    'this is the interactive editor
    ''assign a test value to a variable to use in the test expression
    keylink = "07-J115+001+25681178"
    'now try the variable in an expression to see if it does what we want
    ? word(keylink,1,"+")
    = "07-J115"

    ? word(keylink,2,"+")
    = "001"

    ? word(keylink,3,"+")
    = "25681178"
    When you read the help for a function and see something like

    Word_Delimiter as C

    Read it like

    WORD( Input_String as a character string, Word_Number as a number [optionally because everything past a left bracket is optional, Word_Delimiter as a character string [optionally because everything past a left bracket is optional, Word_Count as a number ]] )

    and when you read as a character string, this means you can substitute anything that yields a character string.

    the name of a character field
    the name of a character type variable
    an expression that yields a character string
    a literal character string
    etc.

    If you pass a literal character string you must enclose it in quotes to tell Alpha that you are not using one of the other choices.
    Last edited by Stan Mathews; 09-21-2007, 03:10 PM.
    There can be only one.

    Comment


      #3
      Re: Extract word from one field to another

      Originally posted by jpayne View Post
      ?word(keylink,1,+)
      quotes are needed around the plus sign

      ?word(keylink,1,"+")

      ps - and what Stan said...
      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


        #4
        Re: Extract word from one field to another

        Just reading what you have, I would say that your field rule for the child does not know where to get keylink - if keylink is a field in the child then
        "word(keylink,1,"+") will produce the first word in keylink.


        You were showing ?word(keylink,1,+) - I don't know what the question mark is - but then the plus sign should be in quotes.

        Hope this works for you

        Tom

        Comment


          #5
          Re: Extract word from one field to another

          Code:
          I've got the keylink to work, the field rule combines 3 other fields into one with a plus sign between each field data.
          
          "Jobnumber"+"Lineitem"+"PurchaseOrder"
          ex.
          07-J115+001+25681178
          "Jobnumber"+"Lineitem"+"PurchaseOrder" will not produce:

          07-J115+001+25681178
          but rather:
          07-J11500125681178

          To get 07-J115+001+25681178 the expression should be:
          Jobnumber+"+"+Lineitem+"+"+PurchaseOrder"

          and it probably be better to use an odd character like a tilde or a pipe instead of the plus sign.
          Last edited by G Gabriel; 09-21-2007, 03:49 PM.

          Comment


            #6
            Re: Extract word from one field to another

            Originally posted by G Gabriel View Post
            Code:
            I've got the keylink to work, the field rule combines 3 other fields into one with a plus sign between each field data.
            
            "Jobnumber"+"Lineitem"+"PurchaseOrder"
            ex.
            07-J115+001+25681178
            "Jobnumber"+"Lineitem"+"PurchaseOrder" will not produce:

            07-J115+001+25681178
            but rather:
            07-J11500125681178

            To get 07-J115+001+25681178 the expression should be:
            Jobnumber+"+"+Lineitem+"+"+PurchaseOrder"

            and it probably be better to use an odd character like a tilde or a pipe instead of the plus sign.
            No real reason to use word separators since the concatenation can just as easily be parsed with substr()

            If a valid keylink value is "07-J11500125681178" then we know that the concatenation of

            "Jobnumber"+"Lineitem"+"PurchaseOrder"
            is composed as indicated of
            07-J115+001+25681178

            then we know where we need to break the string.

            Code:
            keylink = "07-J11500125681178"
            ? substr(keylink,1,7)
            = "07-J115"
            
            ? substr(keylink,8,3)
            = "001"
            
            ? substr(keylink,11)
            = "25681178"
            There can be only one.

            Comment


              #7
              Re: Extract word from one field to another

              then we know where we need to break the string.
              No, we don't:
              The purchase order and lineitem characters may vary, they could contain 3 characters or 11 from record to record.

              Comment


                #8
                Re: Extract word from one field to another

                Originally posted by G Gabriel View Post
                No, we don't:
                Yes, we do..

                If the valid, untrimmed, concatenation per the expression given

                "Jobnumber"+"Lineitem"+"PurchaseOrder"

                yields

                "07-J11500125681178"

                then the defined field length of "Jobnumber" is 7 since there are no trailing spaces. The defined field length of "Lineitem" is three since there are no trailing spaces. The defined field length of of "PurchaseOrder" is unimportant since we can omit the second parameter of substr() for the last portion and capture the rest.

                The purchase order and lineitem characters may vary, they could contain 3 characters or 11 from record to record.
                but the concatenation of same would be something like

                Code:
                "07-J11501 256811  "
                so they start and end in the same position in the string.
                There can be only one.

                Comment


                  #9
                  Re: Extract word from one field to another

                  The defined field length of "Lineitem" is three since there are no trailing spaces.
                  if you use your logic, then you should have 8 spaces between lineitem and PurchaseOrder since lineitem could be anywhere from 3 to 11 chr, meaning the untrimmed field will have 11 spaces.

                  That would yield:
                  Code:
                  "07-J115001        25681178   "
                  If you use untrimmed fields, then you could use substr()

                  By the way:
                  "Jobnumber"+"Lineitem"+"PurchaseOrder" will not even produce:
                  07-J11500125681178
                  but actually:
                  JobnumberLineitemPurchaseOrder !!
                  Last edited by G Gabriel; 09-21-2007, 04:56 PM.

                  Comment


                    #10
                    Re: Extract word from one field to another

                    Originally posted by G Gabriel View Post
                    if you use your logic, then you should have 8 spaces between lineitem and PurchaseOrder since lineitem could be anywhere from 3 to 11 chr, meaning the untrimmed field will have 11 spaces.

                    That would yield:
                    Code:
                    "07-J115001        25681178   "
                    If you use untrimmed fields, then you could use substr()

                    By the way:
                    "Jobnumber"+"Lineitem"+"PurchaseOrder" will not even produce:
                    07-J11500125681178
                    but actually:
                    JobnumberLineitemPurchaseOrder !!
                    I can't imagine what part of the "if" in "If the valid, untrimmed, concatenation per the expression given" eludes you. Please go to my user profile and add me to your ignore list and I'll do the same for you. I've had enough of your arguments.
                    There can be only one.

                    Comment


                      #11
                      Re: Extract word from one field to another

                      First: I didn't start this argument, you have.
                      Second: I am afraid your argument is flawed.
                      I am not sure how you square these two statements:

                      Code:
                      If the valid, [B]untrimmed[/B], concatenation per the expression given
                      with this:
                      The defined field length of "Lineitem" is three since there are no trailing spaces.
                      If it's untrimmed, and if the field allows up to 11 chr, then there should be 8 spaces between Lineitem and PurchaseOrder.

                      The better "if" to understand here is:
                      IF you can't stand the heat...don't start an argument.

                      Comment

                      Working...
                      X