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

Get_Field_From_Body()

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

  • Get_Field_From_Body()

    Their are functions used for email automation which don't have any explanation in the help. I searched the function for a definition but couldn't find any more info. I came across a post that claims that these function only work within the email client environment.

    Is their more info on these functions somewhere?
    Tks
    Bob

    table_to_use = get_field_from_body("Table:*", body)
    table_to_use = alltrim(table_to_use)
    t = table.open(table_to_use, FILE_RW_SHARED)
    t.enter_begin()
    *for_each(x, add_record(t, x), body )
    t.enter_end(.T.)
    t.close()

  • #2
    Re: Get_Field_From_Body()

    Originally posted by bob9145 View Post
    table_to_use = get_field_from_body("Table:*", body)
    Where did you find this function?

    Comment


    • #3
      Re: Get_Field_From_Body()

      It's used in the script for the add record email demo.

      Comment


      • #4
        Re: Get_Field_From_Body()

        Can you post the whole script or reference that demo?

        Comment


        • #5
          Re: Get_Field_From_Body()

          Should be in your tutorial databases email demo.

          'Date Created: 01-Oct-2003 05:25:42 PM
          'Last Updated: 02-May-2005 03:01:53 PM
          'Created By : Aaron Brown
          'Updated By : Aaron Brown


          ' email action to add a record to a table based on contents of email
          ON ERROR GOTO ERROR
          DIM tInbox AS P

          ' cTable & nRecno are defined automatically
          tInbox = table.open(cTable, FILE_RO_SHARED)
          tInbox.fetch_goto(nRecno)

          DIM body AS C
          DIM subject AS C

          subject = tInbox.subject
          body = alltrim(tInbox.body)

          DIM t AS P
          DIM table_to_use AS C

          table_to_use = get_field_from_body("Table:*", body)
          table_to_use = alltrim(table_to_use)
          t = table.open(table_to_use, FILE_RW_SHARED)
          t.enter_begin()
          *for_each(x, add_record(t, x), body )
          t.enter_end(.T.)
          t.close()


          tInbox.close()
          GOTO DONE
          ON ERROR GOTO 0
          ERROR:
          ' log the error
          trace.writeln(error_text_get())
          DONE:


          FUNCTION add_record AS V ( t AS P, x AS C )
          ' takes a string in the format fieldname: value and sets
          ' fieldname to the value specified.
          ' table must already be in change/enter mode
          DIM cEvalField AS C
          DIM cField AS C
          DIM cValue AS C
          DIM field_type AS C

          IF x = ""
          EXIT FUNCTION
          END IF

          cField = alltrim(word(x,1,":"))
          cValue = alltrim(word(x,2,":", 99999))
          cEvalField = "t."+cField
          IF eval_valid(cEvalField)
          field_type = eval(cEvalField+".type_get()")
          IF field_type = "C" .OR. field_type = "M"
          cEval = cEvalField + " = " +quote(cValue)
          ELSE IF field_type = "D"
          cEval = cEvalField + " = {" +cValue + "}"
          ELSE
          cEval = cEvalField + " = " +cValue
          END IF
          evaluate_template(cEval)
          END IF
          END FUNCTION

          Comment


          • #6
            Re: Get_Field_From_Body()

            This script doesn't tell anything about that function. Only thing I could see is that you could use this when you download emails to an alpha table.
            If you find more about this function, please post for further investigation.

            Comment


            • #7
              Re: Get_Field_From_Body()

              I don t think there is anything else. It should be listed among the functions even if it can only be used in the client object.

              Comment


              • #8
                Re: Get_Field_From_Body()

                Originally posted by bob9145 View Post
                Their are functions used for email automation which don't have any explanation in the help. I searched the function for a definition but couldn't find any more info. I came across a post that claims that these function only work within the email client environment.

                Is their more info on these functions somewhere?
                Tks
                Bob

                table_to_use = get_field_from_body("Table:*", body)
                table_to_use = alltrim(table_to_use)
                t = table.open(table_to_use, FILE_RW_SHARED)
                t.enter_begin()
                *for_each(x, add_record(t, x), body )
                t.enter_end(.T.)
                t.close()
                get_field_from_body() is not a function that is part of xbasic. therefore, it is obviously not documented.

                there is a sample project (database) that is shipped with a5 called the 'email features demo'

                this sample project shows examples of certain email features in a5.
                (to load this sample, click the 'sample and tutorial databases...' button on the welcome screen.

                the function you mention is defined in this sample project.

                here is the source code for the function:


                FUNCTION get_field_from_body AS C ( smatch_field AS C, byref body AS C )
                'DESCRIPTION: Retrieve a Colon/CRLF delimited "field" from a message body
                DIM cResult AS C
                DIM body_copy AS C

                body_copy = body

                cResult = filter_string_smatch(body_copy, smatch_field, crlf())
                IF cResult <> ""
                cResult = word(cResult, 2, ":", 99999)
                cResult = alltrim(cResult)
                body = filter_string_smatch(body_copy, smatch_field, crlf(), .T.)
                END IF

                get_field_from_body = cResult
                END FUNCTION

                Comment


                • #9
                  Re: Get_Field_From_Body()

                  Selwyn,

                  A response 1 year+ later???
                  Regards,

                  Ira J. Perlow
                  Computer Systems Design


                  CSDA A5 Products
                  New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                  CSDA Barcode Functions

                  CSDA Code Utility
                  CSDA Screen Capture


                  Comment


                  • #10
                    Re: Get_Field_From_Body()

                    a user asked me a question in which he included a reference to this thread. i was answering his question by putting in a response to the thread, rather than sending him a private message.

                    Comment


                    • #11
                      Re: Get_Field_From_Body()

                      I'm new to this stuff.... please excuse any ignorance of coding....

                      what would I change the code to if I wanted a specific table to be used? instead of using a line in the email message(get field_from_body...) to define what table to use:

                      table_to_use = get_field_from_body("Table:*", body)
                      table_to_use = alltrim(table_to_use)
                      t = table.open(table_to_use, FILE_RW_SHARED)
                      t.enter_begin()
                      *for_each(x, add_record(t, x), body )
                      t.enter_end(.T.)
                      t.close()

                      I am looking to point to a specific table that the data from an email message should be inserted into a new record, my problem is that I can't control having a field in the body of the email message that would be: table: customer
                      so I need to predefine that the table to be used would be the "customer" table.

                      instead of the line: table_to_use = get_field_from_body("Table:*", body)
                      I have tried the code:

                      table_to_use = customer
                      table_to_use = "customer"
                      table_to_use = ("Table:customer", body)

                      none of these have worked, but I don't know what syntax would make this correct.
                      Any suggestions would be appreciated.
                      Last edited by amrbackup; 04-20-2016, 02:16 PM. Reason: additional information

                      Comment

                      Working...
                      X