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

Auto Increment including Year and Month

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

    #16
    Re: Auto Increment including Year and Month

    Sorry didn't post clearly

    1st default value = VAL(RIGHT(CYEAR( DATE() ),2)) *1000000)+(MONTH( DATE() ) *10000)+1

    1st conditional value = RIGHT(SUBSTR(STR((PREVIOUS("SUBMISSION"))),4,3),2)<>LEFT(RIGHT(CDATE(DATE()),4),2)

    second default value = PREVIOUS( "SUBMISSION" )+1

    second conditional value =(SUBSTR(STR(PREVIOUS("SUBMISSION")),5,2))=SUBSTR(DTOC(DATE()),1,2)

    bob sullivan

    Comment


      #17
      Re: Auto Increment including Year and Month

      Bob

      Can you post an image or two of how you have this set up in field rules?

      Thanks...
      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


        #18
        Re: Auto Increment including Year and Month

        I hope this works
        bob
        Attached Files

        Comment


          #19
          Re: Auto Increment including Year and Month

          Bob, I eventually used your code, I just tweeked it a bit
          I left my PROJECT_ID field as an 8 character field,
          Kept the Field Type [/COLOR]PROJECT_ID as an Auto Incremented field
          On the Data Entry Tab, kept the Default Mode as Simple Default Expression with your statement,
          With a few changes, ((RIGHT(CYEAR( DATE() ),2)))+(MONTH( DATE() ) *1000)+1
          Gave it a simple mask style 0000-000, and checked the box don�t store the mask literals in the field.
          Changed my Skip Rule to read PROJECT_D>=1204-001
          As I enter NEW records, everything seems to work just fine.

          Thank you.
          Attached Files

          Comment


            #20
            Re: Auto Increment including Year and Month

            A potential problem with your calculated field value is: You're leaving it to a5 to automatically convert the right part of your equation to char, thus relying on alpha to correct a variable type mismatch. You might want to do it this way instead (to avoid future possible unexpected results):
            (RIGHT(CYEAR( DATE() ),2)) + alltrim(str((MONTH(DATE())*1000)+1)) -> 124001

            ...Or possibly this, if you wish to keep the 0 placeholder:

            (RIGHT(CYEAR( DATE() ),2)) + padl(alltrim(str((MONTH(DATE())*1000)+1)),5,"0") -> 1204001
            Last edited by SNusa; 04-24-2012, 11:11 PM.
            Robert T. ~ "I enjoy manipulating data... just not my data."
            It's all about the "framework." (I suppose an "a5-induced" hard drive crash is now in order?)
            RELOADED: My current posting activity here merely represents a "Momentary Lapse Of Reason."

            Comment


              #21
              Re: Auto Increment including Year and Month

              Try a simple test of opening 2 browses of the table with the rules that you have defined. This is a poor man's way of testing multi user and does test multi form/browse for a single user.

              If you have the auto increment option checked on the first tab, the default value has no bearing on the value after the first record has been saved.

              If you don't have autoincrement turned on, and you enter a record in browse 1, don't save the record and go to browse 2 and enter a record, they will both have the same value. Save the record in one of the browses and the other browse will now be pointing to the same record, but your user will be expecting that they are pointing at their own unique record.

              I wish these ideas would produce the results you want, and they will in a single user environment for a single form/browse, but not in a multi user environment or a multi from/browse situation for a single user...
              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


                #22
                Re: Auto Increment including Year and Month

                Alan, I'm curious ~ Couldn't/wouldn't this approach work:

                How about appending the incrementing/calculated (linking field) with a user ID? You would end up with two transactions like this: 1204-00001AB and 1204-00001RT but at least they would still be mutually exclusive!

                Also, I'm wondering as to why this approach (by Stan Mathews): http://msgboard.alphasoftware.com/al...l=1#post599172 would work [multi-user] when the previous() method (above) causes problems....
                Robert T. ~ "I enjoy manipulating data... just not my data."
                It's all about the "framework." (I suppose an "a5-induced" hard drive crash is now in order?)
                RELOADED: My current posting activity here merely represents a "Momentary Lapse Of Reason."

                Comment


                  #23
                  Re: Auto Increment including Year and Month

                  Originally posted by SNusa View Post
                  Alan, I'm curious ~ Couldn't/wouldn't this approach work:

                  How about appending the incrementing/calculated (linking field) with a user ID? You would end up with two transactions like this: 1204-00001AB and 1204-00001RT but at least they would still be mutually exclusive!
                  That would help with a multi user, but not a multi form/browse with the same user.

                  If found that if Murphy can strike, he will.. So if you want a unique id you better make sure the process generates a unique id.

                  Originally posted by SNusa View Post
                  Also, I'm wondering as to why this approach (by Stan Mathews): http://msgboard.alphasoftware.com/al...l=1#post599172 would work [multi-user] when the previous() method (above) causes problems....
                  I tested Stan's approach and it has the same issue.
                  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


                    #24
                    Re: Auto Increment including Year and Month

                    Originally posted by Al Buchholz View Post
                    That would help with a multi user, but not a multi form/browse with the same user.

                    If found that if Murphy can strike, he will.. So if you want a unique id you better make sure the process generates a unique id.


                    I tested Stan's approach and it has the same issue.
                    Good to know! ~ Thanks

                    ~Also: I have to "chew" on the logistics of the multi form/browse (with same user) thing, as I'm unclear as to why that presents an issue....... Anyone care to elaborate? (please)
                    Last edited by SNusa; 04-25-2012, 10:04 AM.
                    Robert T. ~ "I enjoy manipulating data... just not my data."
                    It's all about the "framework." (I suppose an "a5-induced" hard drive crash is now in order?)
                    RELOADED: My current posting activity here merely represents a "Momentary Lapse Of Reason."

                    Comment


                      #25
                      Re: Auto Increment including Year and Month

                      Originally posted by SNusa View Post
                      Good to know! ~ Thanks

                      ~Also: I have to "chew" on the logistics of the multi form/browse (with same user) thing, as I'm unclear as to why that presents an issue....... Anyone care to elaborate? (please)
                      Did you open 2 browses and try what I stated?
                      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


                        #26
                        Re: Auto Increment including Year and Month

                        You are right about the multiform multibrowse issue.
                        I use this in a single form for sample processing into a laboratory application. The code does work for my application and has since 1994. Just lucky.
                        I have a set that I use to login samples. The field is unique and is used in the parent table of the set.

                        Bob SUllivan

                        Comment


                          #27
                          Re: Auto Increment including Year and Month

                          Originally posted by Al Buchholz View Post
                          Did you open 2 browses and try what I stated?

                          Got it.... I mis-interpreted your statement. (Same user opening two instances of the same form.)
                          Robert T. ~ "I enjoy manipulating data... just not my data."
                          It's all about the "framework." (I suppose an "a5-induced" hard drive crash is now in order?)
                          RELOADED: My current posting activity here merely represents a "Momentary Lapse Of Reason."

                          Comment


                            #28
                            Re: Auto Increment including Year and Month

                            I’m wondering if I use the code (RIGHT(CYEAR( DATE() ),2)) + padl(alltrim(str((MONTH(DATE())*1000)+1)),5,"0") for the result 1204001 will the 0 disappear when the months October, Nov or Dec roll around showing a result of 1210-001 for my first entry in October? I just realized that the code would probably need a bit more to get it to reset at 001 for the first entry of each month change.

                            Comment


                              #29
                              Re: Auto Increment including Year and Month

                              Yes the "0" would be replaced with a "1". Your expression can be simplified with
                              ?SUBSTR(CDATE(DATE()),3,4)+"001"
                              = "1204001"
                              and this way you don't need to use the mask
                              ?SUBSTR(CDATE(DATE()),3,4)+"-001"
                              = "1204-001"

                              However as Al mentioned in post 21 line2, if you have auto increment ticked for this field then after the first record is entered auto increment takes over and ignores this expression. This expression in the default value control in the field rules while auto increment is on is only for seeding the value in the first record.

                              If you want this value to react to changes in date, ie roll over to the next month and restart at "001" then you will need to do this some other way.

                              For a single user setup the link provided by Robert in post 7 is a good way. It uses a custom function which is still used in the default value but with auto increment off.
                              Tim Kiebert
                              Eagle Creek Citrus
                              A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                              Comment

                              Working...
                              X