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

tablemax vs autoincrement

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

    tablemax vs autoincrement

    People.Pplno and People.Init are character fields. We need Pplno to default to tablemax + 1, and (Pplno + Init) to be unique.

    Setting Pplno to autoincrement limits the adjustments we can make when 12001abc, 12001, and 12001xyz need reconciling.

    str(val(tablemax("People",".t.","Pplno"))+1) misbehaves - because Pplno <>Pplno+1?

    How can we use tablemax+1 for the default?

    #2
    Re: tablemax vs autoincrement

    Lookup INCREMENT_VALUE()

    Comment


      #3
      Re: tablemax vs autoincrement

      Originally posted by Sandy Garrett View Post
      Setting Pplno to autoincrement limits the adjustments we can make when 12001abc, 12001, and 12001xyz need reconciling.
      Sandy
      Other than not understanding this statement, my opinion is that autoincrement is useful for internal audit purposes only. It is too restrictive with handling these "12001abc, 12001, and 12001xyz" kind of things

      For any viewable/reference purposes keep a single table, with one record.
      Add as many fields as you need to keep sequences for other purposes in you app.

      Referring to this table for the next increment value available and writing that back after applied (yes USING INCREMENT_VALUE() btw..,) is foolproof, resettable, and can function as an adjudicator for multi-user conflicts.

      Comment


        #4
        Re: tablemax vs autoincrement

        The problem I am trying to ameliorate is lack of a network or internet connection along with need for a unique identifier. For Accessions (items in our museum collection) I tell Agnes when to stay away from her keyboard. We have numbers from 10001 to 29999 and the other office owns 30001 on.

        The plan with the People table is to keep the real entries to the 5-digit ID, Pplno. When users add a person she is identified by the local ID plus the user's initials. Periodically I reconcile any differences, delete the initials, and distribute the de-initialed records.

        Comment


          #5
          Re: tablemax vs autoincrement

          All the more reason to NOT use field rule auto-increment
          A single table, with one record keeps the last pplno.
          Refer to this table for the last value used, INCREMENT_VALUE() and write that back. Then you can control both the 5 digit number at source and alter the main table if necessary when reconciling.
          Make sense?

          Comment


            #6
            Re: tablemax vs autoincrement

            Originally posted by Sandy Garrett View Post
            The problem I am trying to ameliorate is........
            You definitely get the word of the day award... maybe the year...
            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: tablemax vs autoincrement

              Periodically we Copy recently added/changed records and Append them to the master system Unique, replace existing. Usually first_name-middle-last_name works for the Append Keys, but not always.

              If the last # we all have is 12345 and two users add someone, there would be two 12346es and the survivor would depend on who was appended first. I want to tell one user to change her 12346 to 12347.

              Comment


                #8
                Re: tablemax vs autoincrement

                I know what Emiliorate is.
                That happens when my friend Emilio answers any question.
                Probably not the same?

                Comment


                  #9
                  Re: tablemax vs autoincrement

                  Frankly, this thread is irreconcilable.
                  Not really enough information to figure out what is the situation.
                  People.Pplno and People.Init are character fields.
                  Anyone try to make a field with that name..... ain't gunna happen.
                  str(val(tablemax("People",".t.","Pplno"))+1) misbehaves - because Pplno <>Pplno+1?
                  This statement make no sense to me. Is there a situation where Pplno = Pplno+1? Or are you just pointing out you cannot do math on a character field?
                  The plan with the People table is to keep the real entries to the 5-digit ID, Pplno.
                  We now are given a clue that the "people" in the first statement is a table pointer and the field name is actually "pplno"?
                  When users add a person she is identified by the local ID plus the user's initials.
                  Is this to imply that only women are entered into the people table?
                  At this point another variable..... local ID.... has been added to the mix. Is that local ID = the pplno number?
                  ..... when 12001abc, 12001, and 12001xyz need reconciling.
                  If the unique identifier is a concatenated value that includes user initials, how would you ever get 12001 absent letters?

                  Color me confused or just too slow to catch on to what's happening here.
                  Mike W
                  __________________________
                  "I rebel in at least small things to express to the world that I have not completely surrendered"

                  Comment


                    #10
                    Re: tablemax vs autoincrement

                    I always read my posts three times before sending to be sure they cannot be misunderstood, and people rarely admit to understanding even when a solution is found. It's a talent :-(

                    People.dbf is the table, pplno and init are fields therein. Init is C, Pplno has been both during this experiment.

                    str(val(tablemax("People",".t.","Pplno"))+1 was a failed attempt at default value for the pplno field for a new person.

                    As Girl Scouts we are often politically incorrect. You will usually find the Men's room (required by law) full of the janitor's equipment.

                    Init, aka local ID, is any sort of item to identify in which batch this person was entered. At the moment it is three initials the user chooses when she pushes the button that enables entering new records.

                    If the unique identifier is a concatenated value that includes user initials, how would you ever get 12001 absent letters?
                    The plan is to remove the initials when the conflicts are sorted. I can do that now by

                    1. saving (Copy) changed records to a dbf file (we do that anyhow)
                    2. adding the change table to the master workspace.
                    3. manually adjusting the Pplnos
                    4. deleting the Inits
                    5. saving the file
                    6. Appending the file from #4 to the master People table.

                    But if we just do 1 and 6 and then show the duplicates, I'll see where adjustments are needed easily, 4 would be last.

                    Comment


                      #11
                      Re: tablemax vs autoincrement

                      Here's the end result. The People table has a Pplno N field and an Init C field. The default value for Pplno is tablemax("People",".t.","Pplno")+1, Value of expression must be unique, PPLNO+(INIT).

                      The People form starts write protected. It has a button:
                      'Create an XDialog dialog box to prompt for initials.
                      DIM SHARED vinit as C
                      DIM SHARED varC_result as C
                      ok_button_label = "&OK"
                      cancel_button_label = "&Cancel"
                      varC_result = ui_dlg_box("Mark new people",<<%dlg%
                      {region}
                      Initials for new people:| [.4vinit];
                      {endregion};
                      {line=1,0};
                      {region}
                      <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
                      {endregion};
                      %dlg%)
                      if vinit <> ""
                      topparent.Restrict_enter = .f.
                      end if

                      The form also has an on enter event
                      'Set 'Value' property of 'Init' in Form 'People' .
                      parentform:Init.value = vinit

                      And there is a button to help reconciling:
                      tbl = table.current()
                      tbl.unmark_range()
                      tbl.mark_dups2("PPLNO",".T.")
                      topparent.QueryRun("marked()")
                      end

                      Comment

                      Working...
                      X