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

Duplicating Records

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

    Duplicating Records

    I have several tables linked all on the same key field in a set.

    Quote -> Item data
    -> Summary data
    -> Subcon data

    If I duplicate the record in the Quote table what happens to the records linked in the set. Is the record also duplicated in all the tables or just the Quote table?

    Or do I have to open each table, locate the record, duplicate it and then update the key field I am interested in? Then ofcourse update the index.

    I hope this makes sense.

    Paul

    #2
    Re: Duplicating Records

    If I understand what you are trying to do. Just as long as the LINK is the same in all the tables, then when you duplicate a Quote, then if you are displaying the summary and subcon on a form within the set then then data from all 3 tables will be displayed. However, if you change the LINK in the Quote table, then the data from the other two tables will not be displayed.

    Comment


      #3
      Re: Duplicating Records

      Originally posted by Phil Rolf View Post
      If I understand what you are trying to do. Just as long as the LINK is the same in all the tables, then when you duplicate a Quote, then if you are displaying the summary and subcon on a form within the set then then data from all 3 tables will be displayed. However, if you change the LINK in the Quote table, then the data from the other two tables will not be displayed.
      Ok, Say for argument sake the structure of the three tables all have "QuoteNo" as the link field and the table "Quote" has the "QuoteNo" as an autoincrement field. Duplicating the record in the Quote table will produce a new record with a different "QuoteNo" but the linked tables will have what in the "QuoteNo" field???? How do I get all the tables to stay in synchronization.

      I suppose another way of putting it is. Four tables all with a with a common field (QuoteNo), which is linked on that field. Need to be duplicated with the common field (QuoteNo) being updated in all tables to the same value. So the link stays in sync.

      Paul

      Comment


        #4
        Re: Duplicating Records

        You didn't mention (or I missed it) about the auto increment. But once you do the autoincrement then the other 3 tables would not be linked.

        If you are starting a NEW QUOTE, you should not have any data in the other tables that are related to the New Quote. When you enter info in the other tables then they would be begin to be linked together.

        Comment


          #5
          Re: Duplicating Records

          Originally posted by Paul Main View Post
          I have several tables linked all on the same key field in a set.

          Quote -> Item data
          -> Summary data
          -> Subcon data

          If I duplicate the record in the Quote table(parent) what happens to the records linked in the set.Nothing Is the record also duplicated in all the (child)tables... No ...or just the Quote table?Yes

          Or do I have to open each table, locate the record, duplicate it and then update the key field I am interested in? YesThen of course update the index. The indexes should update themselves.

          I hope this makes sense.

          Paul
          The inserted comments I hope answer your questions directly. However having said that you need to go into each child table and specifically duplicate the records there does not mean the process can't be automated/scripted. you should be able to do the whole thing with the right combination of action scripts/or xbasic if you prefer.

          You basically need to first get the linking key value from the original parent record and store it in a variable. Then duplicate the parent record and store the new linking key value into a second variable. Then one child table at a time filter the table using the original linking value, loop through the records duplicating them and inserting the new linking key.

          Should be a piece of cake;)
          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


            #6
            Re: Duplicating Records

            Originally posted by Tim Kiebert View Post
            The inserted comments I hope answer your questions directly. However having said that you need to go into each child table and specifically duplicate the records there does not mean the process can't be automated/scripted. you should be able to do the whole thing with the right combination of action scripts/or xbasic if you prefer.

            You basically need to first get the linking key value from the original parent record and store it in a variable. Then duplicate the parent record and store the new linking key value into a second variable. Then one child table at a time filter the table using the original linking value, loop through the records duplicating them and inserting the new linking key.

            Should be a piece of cake;)
            Tim,

            Yes, that all makes sense to me. I will give it a go and see how I get on. I am not sure it will be a piece of cake for me though.

            One issue. I want to duplicate the record in the child table so I have the same data but the key field reflecting the new record in the parent table.

            Thanks

            Paul
            Last edited by Paul Main; 06-14-2007, 02:17 PM. Reason: Thought of something else

            Comment


              #7
              Re: Duplicating Records

              Paul, my example in the following thread may help:

              http://msgboard.alphasoftware.com/al...ad.php?t=67763

              Comment


                #8
                Re: Duplicating Records

                Paul

                I have an application with the same requirement. My solution involves action scripting, x-dialog and saved operations. Have requested a "Set" based copy operation from the folks at Alpha but I quess its a low priority.

                A/S 1:
                Display an x-dialog box to request the existing "Key" & the "New Key" for the records to be copied. Store in variables.

                A/S 2: Using saved copy operations, 1 per table
                Copy "Key" records from each table to temporary tables.

                A/S 3: Using saved update operations, 1 per table
                Update the "Key" field with "New Key" in the temporary tables.

                A/S 4: Using saved Append operations 1 per table.
                Append Temporary tables to Master tables.

                Note: Attempting to run as 1 A/S does not work. Timing issue ?

                John

                Comment


                  #9
                  Re: Duplicating Records

                  Tom,

                  I have gone through the examples you directed me to. Yes, I can see how they work and as usual the circumstances are slightly different. The main problem I have is understanding the control of which record has focus. I have :

                  vgDupKey1 = 52200, this is the original quote number
                  vgDupKey2 = 52238, this is the new quote number.

                  These I get from the parent table record before and after the duplication of the record.

                  I then use a hidden form to base the processing on. I think this is the right way to do it and use "On Activate"

                  The record data in the child table is:-

                  Child table
                  QuoteNo, ItemNo,etc
                  52200, 52200-1
                  52200, 52200-2
                  52200, 52200-3

                  for example

                  I need to duplicate these records and change the QuoteNo and ItemNo to:-

                  Child table
                  QuoteNo, ItemNo,etc
                  52238, 52238-1
                  52238, 52238-2
                  52238, 52238-3

                  How can I do this. I can't seem to work out the code I need. I think I should use a do while loop. I have thought of using the folowing sequence.

                  1) Query the child table to select the records to duplicate.
                  2) Duplicate the first record and change the QuoteNo and ItemNo fields, save
                  3) got to the next record
                  4) Got to 2) or end if eof()

                  Any help would be more than appreciated.

                  Paul

                  Comment


                    #10
                    Re: Duplicating Records

                    Paul,

                    I took Tom's example and worked it in a sample I have that is for Quotes that involves a parent and a child, not two child tables as in Tom's example. When the Database opens to the main menu, select blue button - br Clients. The duplicate button is there. It runs a script named 'duplicate' that used the record_data_get() and record_data_set() functions.

                    Hope this helps
                    Mike W
                    __________________________
                    "I rebel in at least small things to express to the world that I have not completely surrendered"

                    Comment

                    Working...
                    X