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

Field Rules Calculated

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

  • aburningflame
    replied
    Re: Field Rules Calculated

    Originally posted by Al Buchholz View Post
    An update operation has a genie that helps develop a split of names that can be saved and expanded upon.

    Splitting data into it's elementary parts is not an easy task and is very specific to the data in the source file. It's its own import within a record.

    There are tools for both DBF and SQL to accomplish this.
    It is not an easy task and is very specific to the data in the source file. -Agreed, I was offering him a way to architect and interconnect a function so he can write the logic to help split his data into its elementary parts. We do this sort of thing all the time (Fixing data, importing data, normalizing data) - and I was offering him MY preferred solution. Sure he can use the update genie - not sure how much control that would give him. As I said, he is free to disregard my suggestion completely if he does not feel it suits his needs.

    E.g given a name like
    Mary Ann Davis
    or
    Mary Davis
    You can split this on space, and if length==2 you can assume its First Name [space] Lastname
    If length==3 You can assume its First Name [space] Middle Name [space] Lastname
    If length==4 You can assumine First [space] Middle[space] Last[space] Title

    Of course there are cases this will not work for e.g Mary Ann Davis where "Mary Ann" is the first name. However, this is a good starting point and he will have to review/fix data afterwards - there is no way around having a HUMAN look over it and fixing incorrect data.


    PseudoCode (Not working XBASIC Code) for Splitting Name into its elementary parts:
    Code:
    partsArray = Split Name String by Space
    
    If partsArray Length is 2
    firstname=partsArray[1]
    lastname=partsArray[2]
    
    IF partsArray Length is 3
    firstname=partsArray[1]
    middlename=partsArray[2]
    lastname=partsArray[3]
    
    IF partsArrayLength is 4
    firstname=partsArray[1]
    middlename=partsArray[2]
    lastname=partsArray[3]
    title=partsArray[4]
    Last edited by aburningflame; 09-11-2013, 02:19 PM.

    Leave a comment:


  • Al Buchholz
    replied
    Re: Field Rules Calculated

    Originally posted by aburningflame View Post
    And if he needs more powerful logic than a 1line xbasic statement? E.g checking for a title, etc etc
    An update operation has a genie that helps develop a split of names that can be saved and expanded upon.

    Splitting data into it's elementary parts is not an easy task and is very specific to the data in the source file. It's its own import within a record.

    There are tools for both DBF and SQL to accomplish this.

    Writing a UDF in xbasic is another good way to go for those who choose to write them.
    Last edited by Al Buchholz; 09-11-2013, 02:04 PM.

    Leave a comment:


  • aburningflame
    replied
    Re: Field Rules Calculated

    Originally posted by Dick Anderson View Post
    Scott,
    I need to get this table right. After that I will learn SQL. I have a collaborator working with me in mySQL I will turn this table over to him to use in the application we're building after I get it right.
    Thanks
    Dick
    I recommended you switch to MySQL for NEW apps - it was just a tip and completely unrelated.
    See my other posts for a solution to your problem

    Leave a comment:


  • aburningflame
    replied
    Re: Field Rules Calculated

    Originally posted by Al Buchholz View Post
    Scott

    How does the SQL code/function help a DBF based app?


    Dick
    Allen's response in post 4 of this thread is a good way to proceed...

    http://msgboard.alphasoftware.com/al...l=1#post655104
    And if he needs more powerful logic than a 1line xbasic statement? E.g checking for a title, etc etc

    Leave a comment:


  • Dick Anderson
    replied
    Re: Field Rules Calculated

    Scott,
    I need to get this table right. After that I will learn SQL. I have a collaborator working with me in mySQL I will turn this table over to him to use in the application we're building after I get it right.
    Thanks
    Dick

    Leave a comment:


  • aburningflame
    replied
    Re: Field Rules Calculated

    I work with MySQL and limited DBF - Sometimes I get the 2 mixed up.

    You can try using table.record_content_get or external_record_content_get
    http://support.alphasoftware.com/alp..._GET%28%29.htm
    http://support.alphasoftware.com/alp..._GET%28%29.htm

    Personally I would just create a function FUNCTION ConvertNames as V() so that you can table.open() and loop through records and put a debug(1) up top so you can step through the function 1by1 - this will allow you to test cases / particular cases. Once youre happy you can write the record update call.
    Last edited by aburningflame; 09-11-2013, 01:38 PM.

    Leave a comment:


  • Al Buchholz
    replied
    Re: Field Rules Calculated

    Scott

    How does the SQL code/function help a DBF based app?


    Dick
    Allen's response in post 4 of this thread is a good way to proceed...

    http://msgboard.alphasoftware.com/al...l=1#post655104

    Leave a comment:


  • aburningflame
    replied
    Re: Field Rules Calculated

    Not too familiar with DBF (I would really recommend using MySQL when starting a new application) - However...

    Create a function
    Code:
    FUNCTION convertFullName AS C(name as C)
         dim newname as C=name
         'youre gonna eventually write code in here to convert to the new name - but for now leave as is
         '[CONVERT CODE GOES HERE]
         convertFullName=newname
    END FUNCTION
    Then write:
    ?sql_get_values("::name::conn","mytable","1=1","convertFullName(namefield)") - Currently what you should see is the actual fullname.

    In the above function replace [CONVERT CODE GOES HERE] with newname="COUNT DRACULA" , save it, then run the sql_get_values again, everyones name should be count dracula now. Once youve confirmed that works replace newname="COUNT DRACULA" with the logic to actually split the fullname and create a new name and then you w ill have to return each namepart from the function (change the function return to P, define a P variable, define firstname,middlename,lastname in the P variable, in the convert code assign these variables) - you can then use this function in an update loop.

    If you need assistance, you can give us a call and we can discuss rates. We can work with you and teach/show you what options you have.

    Thanks,
    Scott
    Last edited by aburningflame; 09-11-2013, 01:14 PM.

    Leave a comment:


  • Dick Anderson
    replied
    Re: Field Rules Calculated

    Can't I write a expression in an immediate window where it will display the results for each record in a given table such as below? How do I access an immediate window?

    ? word("This is a test", 4)
    = "test"

    dim FULLNAME as C = "Di King"
    ? word(FULLNAME, 1)
    = "Di"

    dim FULLNAME as C = "John J. Smith"
    ? word(FULLNAME, w_count(FULLNAME))
    = "Smith"

    ? word("the quick brown fox", -1)
    = "fox"

    ? word("John Smith, Alpha Software, BurlingtonMA01803", 3, ",")
    = "BurlingtonMA01803"

    ? word("now is the time", 2, " ", 3)
    = "is the time"

    Thank you ..............Dick
    Last edited by Dick Anderson; 09-11-2013, 12:58 PM.

    Leave a comment:


  • aburningflame
    replied
    Re: Field Rules Calculated

    Originally posted by Dick Anderson View Post
    Scott......What language is "if length=="..........Dick
    It was Alpha - it would be the array length e.g dim length as N=arrayVar.size() , or see example below

    Splitting the name on space would ideally return an array

    Something like:
    Code:
    LOOP THROUGH USERS:
    
    dim firstname as C
    dim lastname as C
    dim middlename as C
    dim names_for_person[1] as C = split_name_on_space(namefield) 'this function does not exist, you will have to write it yourself 
    'other languages have a string.split(strVar," ") <<split on space or 
    'string.split(strVar,",") <<split string on comma - but alpha doesnt have this funciton (youll need to write it urself)
    if names_for_person.size()==2 then
        firstname=names_for_person[1]
        lastname=names_for_person[2]
    else if names_for_person.size()==3 '3 names
         firstname=names_for_person[1]
         middlename=names_for_person[2]
         lastname=names_for_person[3]
    end if
    
    'write the record update down here 
    'UPDATE RECORD 
    
    'GO TO NEXT USER
    Something like this is probably the closest youre gonna get.
    There are names that it will fail to convert (computers are stupid machines)
    Example: Mary Ann Davis (Mary wil be first, ann will be middlename, davis will be lastname) where as her first name really could be Mary Ann and her lastname Davis and she has no middle name - Youre going to have to handle these yourself unfortunately. And herein lies the issue with compound fields - if the database was designed as firstname, middlename, lastname from day1 - you wouldnt be stuck doing this :( Well,Gluck!
    Last edited by aburningflame; 09-11-2013, 12:43 PM.

    Leave a comment:


  • Dick Anderson
    replied
    Re: Field Rules Calculated

    Scott......What language is "if length=="..........Dick

    Leave a comment:


  • Dick Anderson
    replied
    Re: Field Rules Calculated

    Allen.....I have more problems then that. Some names have Jr, III, 2nd, 3rd and etc. as well as Van Holland. Some names have 3 middle names. This is going to be a problem because I have hundreds of thousands of names to convert. Don't know how to access genie..........Dick

    Leave a comment:


  • aburningflame
    replied
    Re: Field Rules Calculated

    Or write a function to open the table, and loop through each record.
    Then split the name on space character.
    if length==2 then you probably have firstname lastname
    if length==3 then you probably have first middle lastname
    There are exceptions to the rule above - you will have to handle these manually

    You can always have your function write to a csv file so you can preview all the names.
    When your happy with the csv output.
    Backup your table and add the code to actually record_update() or w/e youre using
    Then execute that code

    Leave a comment:


  • Allen Klimeck
    replied
    Re: Field Rules Calculated

    First backup your table than add new fields to the end of the table & use an update operation to update the new fields. There is a genie to help you however hyphenated name's & name's like Mac Donald & the like will trip you up.

    Leave a comment:


  • Dick Anderson
    replied
    Re: Field Rules Calculated

    I don't use SQL. I was planning to use xbasic. Hoping to use an immediate function to preview results. I am just transforming a table.

    Leave a comment:

Working...
X