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

Creating a Branch Table ... Question on Xbasic Speed ...

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

    Creating a Branch Table ... Question on Xbasic Speed ...

    I thought I would ask those who know ALOT MORE about Xbasic than I do ...

    I am going to have to parse at least 8 different values from a field and make decisions from that.

    In the Code I have so far I have 8 IF statements ... the program multiplies 2 different numbers based on the 2 pairs of 2 chars it decodes. I am going to end up with at least 12 - 16 IF by the time I finish decoding all the values.

    What has your experience been on SPEED?? This loop will have to be executed 1 time for every record in this customer database (7000 records and growing)? And this program will run 1 time per day.

    I was wondering CASE / IF / SOMETHING ELSE / what executes faster? Or is it all about the same?

    Below I have included 2/3 of the loop decoding but I have 1/3 left to do. I looked at the coding for CASE and it didn't seem to save me anything ... I am wanting to do it the best way. I also considered doing a FOR I = 1 to recno ... but I didn't really see that helping much either.

    p.s. my code was indented correctly I am new here and forgot this window flattens my code if I don't put it in the special window.

    Thanks for Your Help in Advance!!

    Jim Coyle

    Code here ...........

    ptr = table.open("people")
    recno = ptr.records_get()

    while .not. ptr.fetch_eof()

    ptr.change_begin()
    ph_prg = ptr.ph_code
    last_p = ptr.last_ph
    con_prg = ptr.con_code
    last_c = ptr.last_con

    times = val(right(ph_prg,1))

    if left(ph_prg,1)="S" then
    call_p = 1
    end if
    if left(ph_prg,1)="W" then
    call_p = times/7
    end if
    if left(ph_prg,1)="M" then
    call_p = times/30
    end if
    if left(ph_prg,1)="Y" then
    call_p = times/365
    end if

    ph_flg = (date()-last_p)*call_p
    if ph_flg >= 1 then
    ptr.ph_flg=.t.
    else
    ptr.ph_flg=.f.
    end if

    times = val(right(con_prg,1)) ' caution I reassign (REUSE) TIMES here ...

    if left(con_prg,1)="W" then
    call_c = times/7
    end if
    if left(con_prg,1)="M" then
    call_c = times/30
    end if
    if left(con_prg,1)="Y" then
    call_c = times/365
    end if

    con_flg = (date()-last_c)*call_c
    if con_flg >= 1 then
    ptr.con_flg=.t.
    else
    ptr.con_flg=.f.
    end if

    ptr.change_end(.t.)
    ptr.fetch_next()
    end while
    ptr.close()
    ui_msg_box("PEOPLE Records have been Updated-",recno)
    end
    Truth between candid minds can never do harm. Thomas Jefferson
    The more I study nature, the more I stand amazed at the work of the Creator. Louis Pasteur

    #2
    Re: Creating a Branch Table ... Question on Xbasic Speed ...

    I have come a little further with this ... Version 2 ... I now have all my selections decoded and it works without error.
    I will either have to make sure the people db is closed when this is run (which it should be) or I will have to include a check to see if it's already open (which I probably will add). and I included a TXT file as I have seen others do so the code won't get flattened against the left margin.

    Thanks !
    Attached Files
    Truth between candid minds can never do harm. Thomas Jefferson
    The more I study nature, the more I stand amazed at the work of the Creator. Louis Pasteur

    Comment


      #3
      Re: Creating a Branch Table ... Question on Xbasic Speed ...

      Hi Jim
      I could only perhaps suggest using one statement rather than six plus a variable as in
      Code:
      ptr.ph_flg = (date()-last_p)*call_p >= 1
      and really I cant imagine any noticeable difference in speed but I just lean towards economical statements and minimal variable manipulations (that may be harder to read later).
      Likewise for ptr.con_flg

      Comment


        #4
        Re: Creating a Branch Table ... Question on Xbasic Speed ...

        Ray, Thanks for the help I will work on that. Jim
        Truth between candid minds can never do harm. Thomas Jefferson
        The more I study nature, the more I stand amazed at the work of the Creator. Louis Pasteur

        Comment


          #5
          Re: Creating a Branch Table ... Question on Xbasic Speed ...

          Jim,

          I think it would be prudent to explicitly set a controlling (primary) index, and then fetch the first record, before beginning your while ... end while loop. Your present code assumes the table will open unfiltered, with the record pointer positioned on record 1.

          -- tom

          Comment


            #6
            Re: Creating a Branch Table ... Question on Xbasic Speed ...

            Tom, Thanks I understand your point, I will do that! ... and by the way I am going over the xbasic quizes that you put forth and managed ... (I usually go over each person method) ... a great help! Thanks for your time on that! I am new, are you still planning on doing anymore of those? ... no pressure just wondering? Jim Coyle
            Truth between candid minds can never do harm. Thomas Jefferson
            The more I study nature, the more I stand amazed at the work of the Creator. Louis Pasteur

            Comment

            Working...
            X