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

Turning off Auto Increment during append

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

    #16
    Re: Turning off Auto Increment during append

    Jeff,
    Try commenting out

    Code:
    rul.sysid.Default.Default = ""
    rul.sysid.Default.Type = "None"
    And
    Code:
    rul.sysid.Default.Default = "00001" 
    rul.sysid.Default.Type = "Simple"
    as I don't think it is needed to change them to do what you want anyway.
    Mike
    __________________________________________
    It is only when we forget all our learning that we begin to know.
    It's not what you look at that matters, it's what you see.
    Henry David Thoreau
    __________________________________________



    Comment


      #17
      Re: Turning off Auto Increment during append

      Jeff,
      I know that if I have a form open and try to change the table field rules, that the program will warn that no changes will be saved. I still think that between the field rule change and the append and then to change back the field rule, that you are better off closing the table before the append. And if you are running this script from a form that uses the table, that it would not save the field rule changes anyway.

      You could perhaps have a button on the form call this routine as a global script which would first close the form and reopen it at the end.
      Robin

      Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

      Comment


        #18
        Re: Turning off Auto Increment during append

        Try it this way.

        Code:
        'Date Created: 24-Mar-2008 09:06:46 PM
        'Last Updated: 24-Mar-2008 09:06:46 PM
        'Created By : 
        'Updated By : 
        tbl = table.open("test")
        rul = tbl.rules_get()
        rul.change_begin()
        rul.sysid.data_type = "User"
        rul.sysid.Default.Default = ""
        rul.sysid.Default.Type = "None"
        rul.change_end(.t.)
        'tbl.close() '<- don't do this since we're using the tbl pointer later
        
        
        append.t_db = "test2"
        append.m_key = ""
        append.t_key = ""
        append.m_filter = ""
        append.t_filter = ""
        append.type = "All"
        append.m_count = 1
        append.m_field1 = "SYSID"
        append.m_exp1 = "@Test2->Sysid"
        append.t_count = 0
        'tbl.enter_end(.T.) 'don't see where this is necessary and will cause an error
        'because an enter has not begun
        'Prompt for confirmation before running the Operation.......
        dim rec_count as n 
        rec_count = a5_get_records_in_query("test2",append.t_filter)
        message_text = "A maximum of "+rec_count + " record(s) will be appended from 'test2', to 'test'. "+crlf(2)+ "OK to proceed?"
        operation_result=ui_msg_box("Append Operation",message_text,UI_OK_CANCEL+ UI_FIRST_BUTTON_DEFAULT+ UI_INFORMATION_SYMBOL)
        If operation_result <> ui_ok_selected then 
        end 
        end if 
        
        
        tbl.append()
        
        'Display a dialog box showing the results of the Operation
        [COLOR="red"]'a5_append_op_result(a_records_processed,a_records_total,a_records_violated, "test")[/COLOR]
        'this was causing a problem with the table remaining in use
        'If the Operation is run from within a Form or Browse, then refresh the window
        if is_object(topparent.this) then 
        if topparent.Class() = "form" .or. topparent.class() = "browse" then 
        topparent.Refresh_layout()
        end if 
        end if 
        [COLOR="red"]tbl.close()[/COLOR]
        
        tbl = table.open("test")
        rul = tbl.rules_get()
        rul.change_begin()
        rul.sysid.data_type = "AutoInc"
        rul.sysid.Default.Type = "Simple" <-this was reversed with next line
        'couldn't set default value until default type was established
        rul.sysid.Default.Default = [COLOR="Red"]quote([/COLOR]"00001"[COLOR="red"])[/COLOR] '<-change this to whatever your real default might be
        rul.change_end(.t.)
        tbl.close()
        There can be only one.

        Comment


          #19
          Re: Turning off Auto Increment during append

          Thats it. It works. Thanks Stan and everyone else.

          Comment


            #20
            Re: Turning off Auto Increment during append

            One other thing.
            Where would this be documented?
            What about if I wanted to do this with a calc field rule or a posting field rule.
            Ex. rul.sysid.data Type= ?????? ( posting, calc. etc.)
            Thanks.

            Comment


              #21
              Re: Turning off Auto Increment during append

              Jeff,

              The onliine help file is where I always look first. Here is one link and within it are other links related to what is needed. I searched under "field rules" and then chose "change with xbasic"

              http://support.alphasoftware.com/alp...le_Methods.htm
              Mike
              __________________________________________
              It is only when we forget all our learning that we begin to know.
              It's not what you look at that matters, it's what you see.
              Henry David Thoreau
              __________________________________________



              Comment


                #22
                Re: Turning off Auto Increment during append

                Originally posted by Jeff Richards View Post
                One other thing.
                Where would this be documented?
                What about if I wanted to do this with a calc field rule or a posting field rule.
                Ex. rul.sysid.data Type= ?????? ( posting, calc. etc.)
                Thanks.
                If you want to see the field rules set in a table you can go to the interactive window and try this:

                dim tbl as p
                tbl = table.open("yourtablename")
                rul=tbl.rules_get()
                ?rul 'gives the fields
                ?rul.yourfieldname 'gives the rules for the field

                It will display the current values - and don't forget to type afterwards:

                tbl.close()

                Edit: See Stan's link below
                Last edited by MoGrace; 03-27-2008, 02:10 PM. Reason: Fixed my syntax oops
                Robin

                Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                Comment


                  #23
                  Re: Turning off Auto Increment during append

                  Originally posted by MoGrace View Post
                  If you want to see the field rules set in a table you can go to the interactive window and try this:

                  dim tbl as p
                  tbl = table.open("yourtablename")
                  ?tbl.rules_get()

                  It will display the current values - and don't forget to type afterwards:

                  tbl.close()
                  There's a pretty good discussion here about how to see the rules associated with each field. I believe the method suggested will only reveal methods and field names.
                  There can be only one.

                  Comment


                    #24
                    Re: Turning off Auto Increment during append

                    This is a great thread. thanks everyone.

                    Where is the rul. method documented? I want to set the value for a calculated field. (for example date()

                    What would go in the ????? below

                    tbl = table.open("family")
                    rul = tbl.rules_get()
                    rul.change_begin()
                    rul.date_mod.data_type = "Calc"
                    rul.date_mod.????? = 'Date()'
                    rul.change_end(.t.)
                    tbl.close()
                    Logical Design
                    Keven Thibeault
                    Boston, Massachusetts
                    Dwell in possibility

                    Comment


                      #25
                      Re: Turning off Auto Increment during append

                      EDIT: as Robin posted above

                      To find out what kind of properties you have to work with do the following in the Interactive window.
                      Code:
                      tbl = table.open("family")
                      rul = tbl.rules_get()
                      ?rul.date_mod
                      This will give you a whole list of properties of rul.date_mod. The properties preceded with a '+' have sub properties. When I want to find out what property to use I put some weird but valid data in the property of interest using the standard method, ie the field rule editor, and then go exploring in the interactive window.

                      In this case the property you are looking for is called, funnily enough :) , 'calc'.

                      MikeC posted a link to the help in a previous thread.
                      Last edited by Tim Kiebert; 04-04-2008, 10:18 PM.
                      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


                        #26
                        Re: Turning off Auto Increment during append

                        I feel like Sherlock holmes sometimes! or is it James Bond?

                        THANKS for your help. I learn something new about this tool every single day. Thanks especially to the great team of support around the world. cheers mate!
                        Logical Design
                        Keven Thibeault
                        Boston, Massachusetts
                        Dwell in possibility

                        Comment

                        Working...
                        X